Handling environments with cibuildwheel
As kanged from NumPy.
1set -xe
2# Kanged from NumPy:
3# https://github.com/numpy/numpy/blob/main/tools/wheels/cibw_before_build.sh
4
5# remove any cruft from a previous run
6rm -rf build
7
8# TODO: delete along with enabling build isolation by unsetting
9# CIBW_BUILD_FRONTEND when numpy is buildable under free-threaded
10# python with a released version of cython
11FREE_THREADED_BUILD="$(python -c"import sysconfig; print(bool(sysconfig.get_config_var('Py_GIL_DISABLED')))")"
12if [[ $FREE_THREADED_BUILD == "True" ]]; then
13 python -m pip install setuptools
14 python -m pip install -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple cython numpy
15fi
Which works quite nicely, just from within the pyproject.toml
.
1[tool.cibuildwheel]
2before-build = "bash {project}/tools/wheels/cibw_before_build.sh {project}"
Helpfully this also can be used to set variables and propagate things based on other conditions like operating systems.
Comments