Skip to content

Commit 89979cb

Browse files
committed
BLD: Use NumPy nightly wheels for non-release builds
This uses the NumPy nightlies for non-release builds to ensure the matplotlib nightlies uploaded are build against the new NumPy version. These nightlies are not tested, but if they were they should actually still be tested against the release NumPy. This is necessary to allow NumPy to enforce API changes, it does mean that potential C-API breaks in NumPy need quicker follow-up unfortunately (either in NumPy or in matplotlib).
1 parent 378d115 commit 89979cb

File tree

1 file changed

+29
-6
lines changed

1 file changed

+29
-6
lines changed

.github/workflows/cibuildwheel.yml

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,35 @@ jobs:
9090
name: Build wheels on ${{ matrix.os }} for ${{ matrix.cibw_archs }}
9191
runs-on: ${{ matrix.os }}
9292
env:
93-
CIBW_BEFORE_BUILD: >-
94-
pip install numpy>=1.25 &&
95-
rm -rf {package}/build
96-
CIBW_BEFORE_BUILD_WINDOWS: >-
97-
pip install delvewheel numpy>=1.25 &&
98-
rm -rf {package}/build
93+
# The following commands branch based on whether we are on the main
94+
# branch or have a PR into main. For these, we use the NumPy 2.0
95+
# nightlies to ensure future C-API/ABI compatibility.
96+
# This branching becomes unnecessary when NumPy 2.0 is released.
97+
# When using no-build-isolation we need to install all requirements.
98+
CIBW_BEFORE_BUILD:
99+
${{ (((github.event_name == 'push' && github.ref == 'refs/heads/main') ||
100+
(github.event_name == 'pull_request' && github.base_ref == 'refs/heads/main')) &&
101+
'pip install meson-python pybind11 setuptools_scm "setuptools>=64" ninja &&
102+
pip install "numpy>=2.0.0.dev0" --extra-index-url "https://pypi.anaconda.org/scientific-python-nightly-wheels/simple" &&
103+
rm -rf {package}/build'
104+
) ||
105+
'pip install "numpy>=1.25" &&
106+
rm -rf {package}/build'
107+
}}
108+
CIBW_BEFORE_BUILD_WINDOWS:
109+
${{ (((github.event_name == 'push' && github.ref == 'refs/heads/main') ||
110+
(github.event_name == 'pull_request' && github.base_ref == 'refs/heads/main')) &&
111+
'pip install delvewheel meson-python pybind11 setuptools_scm "setuptools>=64" ninja &&
112+
pip install "numpy>=2.0.0.dev0" --extra-index-url "https://pypi.anaconda.org/scientific-python-nightly-wheels/simple" &&
113+
rm -rf {package}/build'
114+
) ||
115+
'pip install delvewheel "numpy>=1.25" &&
116+
rm -rf {package}/build'
117+
}}
118+
CIBW_BUILD_FRONTEND: >-
119+
${{ (((github.event_name == '' && github.ref == 'refs/heads/main') ||
120+
(github.event_name == 'pull_request' && github.base_ref == 'refs/heads/main')) &&
121+
'pip; args: --no-build-isolation') || 'build' }}
99122
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: >-
100123
delvewheel repair -w {dest_dir} {wheel}
101124
CIBW_AFTER_BUILD: >-

0 commit comments

Comments
 (0)