Skip to content

Commit aae33c0

Browse files
authored
BLD: Allow building with NumPy nightlies and use it for nightlies (#55594)
I am not sure that this is uncontested that this is a good version pin change. I also took the liberty of removing the current use of oldest-support-numpy, since Python 3.9 means that you should normally always get 1.25 anyway and that should work for any NumPy version. The `<=2.0.0.dev0` is a way to explicitly allow NumPy nightly wheels, although of course you need the additional URL to use it. In a release version, it might be nicer to not have it, but it also should not really hurt since the you are unlikely to have the NumPy dev wheels available unless you really want them. (Not sure how to best test that the changes work as is.)
1 parent 4412800 commit aae33c0

File tree

3 files changed

+25
-6
lines changed

3 files changed

+25
-6
lines changed

.circleci/config.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,12 @@ jobs:
4949
no_output_timeout: 30m # Sometimes the tests won't generate any output, make sure the job doesn't get killed by that
5050
command: |
5151
pip3 install cibuildwheel==2.15.0
52+
# When this is a nightly wheel build, allow picking up NumPy 2.0 dev wheels:
53+
if [[ "$IS_SCHEDULE_DISPATCH" == "true" || "$IS_PUSH" != 'true' ]]; then
54+
export CIBW_ENVIRONMENT="PIP_EXTRA_INDEX_URL=https://pypi.anaconda.org/scientific-python-nightly-wheels/simple"
55+
fi
5256
cibuildwheel --prerelease-pythons --output-dir wheelhouse
57+
5358
environment:
5459
CIBW_BUILD: << parameters.cibw-build >>
5560

.github/workflows/wheels.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,14 +137,27 @@ jobs:
137137
shell: bash -el {0}
138138
run: echo "sdist_name=$(cd ./dist && ls -d */)" >> "$GITHUB_ENV"
139139

140-
- name: Build wheels
140+
- name: Build normal wheels
141+
if: ${{ (env.IS_SCHEDULE_DISPATCH != 'true' || env.IS_PUSH == 'true') }}
141142
uses: pypa/cibuildwheel@v2.16.2
142143
with:
143144
package-dir: ./dist/${{ matrix.buildplat[1] == 'macosx_*' && env.sdist_name || needs.build_sdist.outputs.sdist_file }}
144145
env:
145146
CIBW_PRERELEASE_PYTHONS: True
146147
CIBW_BUILD: ${{ matrix.python[0] }}-${{ matrix.buildplat[1] }}
147148

149+
- name: Build nightly wheels (with NumPy pre-release)
150+
if: ${{ (env.IS_SCHEDULE_DISPATCH == 'true' && env.IS_PUSH != 'true') }}
151+
uses: pypa/cibuildwheel@v2.16.2
152+
with:
153+
package-dir: ./dist/${{ matrix.buildplat[1] == 'macosx_*' && env.sdist_name || needs.build_sdist.outputs.sdist_file }}
154+
env:
155+
# The nightly wheels should be build witht he NumPy 2.0 pre-releases
156+
# which requires the additional URL.
157+
CIBW_ENVIRONMENT: PIP_EXTRA_INDEX_URL=https://pypi.anaconda.org/scientific-python-nightly-wheels/simple
158+
CIBW_PRERELEASE_PYTHONS: True
159+
CIBW_BUILD: ${{ matrix.python[0] }}-${{ matrix.buildplat[1] }}
160+
148161
- name: Set up Python
149162
uses: mamba-org/setup-micromamba@v1
150163
with:

pyproject.toml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ requires = [
66
"meson==1.2.1",
77
"wheel",
88
"Cython>=0.29.33,<3", # Note: sync with setup.py, environment.yml and asv.conf.json
9-
# Note: numpy 1.25 has a backwards compatible C API by default
10-
# we don't want to force users to compile with 1.25 though
11-
# (Ideally, in the future, though, oldest-supported-numpy can be dropped when our min numpy is 1.25.x)
12-
"oldest-supported-numpy>=2022.8.16; python_version<'3.12'",
13-
"numpy>=1.26.0,<2; python_version>='3.12'",
9+
# Any NumPy version should be fine for compiling. Users are unlikely
10+
# to get a NumPy<1.25 so the result will be compatible with all relevant
11+
# NumPy versions (if not it is presumably compatible with their version).
12+
# Pin <2.0 for releases until tested against an RC. But explicitly allow
13+
# testing the `.dev0` nightlies (which require the extra index).
14+
"numpy>1.22.4,<=2.0.0.dev0",
1415
"versioneer[toml]"
1516
]
1617

0 commit comments

Comments
 (0)