Skip to content

Commit

Permalink
Fix minor build issues (#4)
Browse files Browse the repository at this point in the history
* Python 3.13 is still not out so max supported version is 3.12
* due to `before-all` and `before-build` being run _before_ any
  of the `build-system.requires` packages are installed,
  conan is now explicitly installed via pip on MacOS
* fix strange build issue on Linux (had to do with the declaration
  of functions in Cython)
* update docs
  • Loading branch information
JCGoran authored Sep 1, 2024
1 parent 7cb95f0 commit 7a56ea1
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 15 deletions.
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ if(COFFE_ENABLE_PYTHON)
# need to use this annoying hack. Note that this does not guarantee that the
# Python executable is the one from the venv, but at least it finds the one
# compatible with all of the packages from the venv
if(NOT COFFE_PYTHON_MINOR_VERSION)
execute_process(
COMMAND python -c "import sys;print(sys.version_info.minor)"
OUTPUT_VARIABLE COFFE_PYTHON_MINOR_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
find_package(
Python "3.${COFFE_PYTHON_MINOR_VERSION}" EXACT
COMPONENTS Interpreter Development.Module
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ pip install conan
Then, generate a profile:

```sh
conan profile detect
conan profile detect --force
```

Finally, install all of the dependencies in the `_build` directory:
Expand Down Expand Up @@ -134,6 +134,12 @@ If you would additionally like to install all of the various tools for testing,
pip install '.[all]'
```

**NOTE**: if using Conan to install some of the dependencies, you will need to specify the toolchain file using:

```sh
pip install '.[all]' --config-settings=cmake.define.CMAKE_TOOLCHAIN_FILE="_build/conan_toolchain.cmake"
```

## Documentation

The documentation for the latest version is available [here](https://jcgoran.github.io/coffe/).
Expand Down
12 changes: 3 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "coffe"
dynamic = ["version"]
description = "Python wrapper for the COrrelation Function Full-sky Estimator code"
readme = "README.md"
requires-python = ">=3.8"
requires-python = ">=3.8,<3.13"
authors = [
{name = "Goran Jelic-Cizmek", email = "[email protected]"},
]
Expand Down Expand Up @@ -63,6 +63,7 @@ test-command = ["python -c 'import coffe'", "pytest -vvv -k test_power_spectrum
[tool.cibuildwheel.macos]
before-all = [
# install CUBA, FFTW, GSL, libconfig, and CLASS
"python -m pip install conan",
"conan profile detect --force",
"conan install . --output-folder=_build --build=missing",
"bash scripts/install_other.sh cuba class",
Expand All @@ -82,11 +83,6 @@ environment-pass = ["SETUPTOOLS_SCM_PRETEND_VERSION"]
[build-system]
requires = [
"scikit-build-core", "cython<3", "setuptools-scm>=8.0.0",
# why do we need Conan only on Darwin (i.e. MacOS)?
# because GSL, FFTW, etc. installed via `brew` always have the
# deployment target equal to the one of the build machine,
# while Linux does not care about this
"conan; sys_platform=='darwin'"
]
build-backend = "scikit_build_core.build"

Expand All @@ -104,11 +100,9 @@ verbose = true
version = ">=3.15.0"

[tool.scikit-build.cmake.define]
# on MacOS, this probably doesn't work;
# to make a wheel, just use `cibuildwheel --platform macos`
COFFE_ENABLE_CLASS = "ON"
COFFE_ENABLE_PYTHON = "ON"
COFFE_ENABLE_MATHOPTS = "ON"
COFFE_ENABLE_CUBA="ON"
COFFE_ENABLE_CUBA = "ON"

[tool.setuptools_scm]
8 changes: 3 additions & 5 deletions python/coffe/coffe.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@

cdef extern from "<gsl/gsl_errno.h>":

cdef struct gsl_error_handler_t:
pass

cdef gsl_error_handler_t *gsl_set_error_handler_off()
ctypedef void (*gsl_error_handler_t) (const char* reason, const char* file, int line, int gsl_errno)

cdef void gsl_set_error_handler(gsl_error_handler_t *)
gsl_error_handler_t* gsl_set_error_handler(gsl_error_handler_t* new_handler)

gsl_error_handler_t* gsl_set_error_handler_off()

cdef extern from "<gsl/gsl_spline.h>":

Expand Down

0 comments on commit 7a56ea1

Please sign in to comment.