Skip to content

Commit d120029

Browse files
leofangclaude
andcommitted
Pre-build numpy for Python 3.15; exclude 3.15 from releases
numpy 2.4.x has no pre-built wheel for Python 3.15 yet, and its [tool.cibuildwheel] config is incompatible with cibuildwheel v4.0. Build numpy from patched sdist via cibuildwheel with -Dallow-noblas=true on all platforms (linux-64, linux-aarch64, win-64). Also exclude python315 artifacts from release publishing since 3.15 is pre-release and not ready for PyPI. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent d5b5bbb commit d120029

4 files changed

Lines changed: 91 additions & 0 deletions

File tree

.github/workflows/build-wheel.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,68 @@ jobs:
365365
run: |
366366
pip install cuda_pathfinder/*.whl
367367
368+
- name: Hide GNU link.exe so Meson finds MSVC link.exe
369+
if: ${{ startsWith(inputs.host-platform, 'win') }}
370+
run: |
371+
if [ -f "/c/Program Files/Git/usr/bin/link.exe" ]; then
372+
mv "/c/Program Files/Git/usr/bin/link.exe" "/c/Program Files/Git/usr/bin/link.exe.bak"
373+
fi
374+
375+
- name: Download and patch numpy sdist (pre-release Python)
376+
if: ${{ startsWith(matrix.python-version, '3.15') }}
377+
run: |
378+
pip download --no-binary numpy --no-deps "numpy>=1.21.1" -d numpy-sdist/
379+
cd numpy-sdist && tar xf numpy-*.tar.gz && rm numpy-*.tar.gz
380+
# WAR: numpy 2.4.x ships [tool.cibuildwheel] config that is
381+
# incompatible with cibuildwheel v4.0 (cpython-freethreading enable
382+
# group, OpenBLAS before-build scripts, etc.). Strip the cibuildwheel
383+
# sections but preserve [tool.meson-python] (vendored meson path).
384+
python -c "
385+
import glob
386+
for f in glob.glob('numpy-*/pyproject.toml'):
387+
lines, skip = open(f).readlines(), False
388+
out = []
389+
for line in lines:
390+
hdr = line.strip()
391+
if hdr.startswith('[tool.cibuildwheel') or hdr.startswith('[[tool.cibuildwheel'):
392+
skip = True
393+
continue
394+
if skip and hdr.startswith('[') and 'cibuildwheel' not in hdr:
395+
skip = False
396+
if not skip:
397+
out.append(line)
398+
open(f, 'w').writelines(out)
399+
"
400+
echo "NUMPY_SRC_DIR=$(pwd)/$(ls -d numpy-*/)" >> $GITHUB_ENV
401+
402+
- name: Build numpy wheel (pre-release Python)
403+
if: ${{ startsWith(matrix.python-version, '3.15') }}
404+
uses: pypa/cibuildwheel@54327ab9d35de03b359ac25c97de9417d94639c0 # v4.0.0rc1
405+
env:
406+
CIBW_BUILD: ${{ env.CIBW_BUILD }}
407+
CIBW_ARCHS_LINUX: "native"
408+
CIBW_BUILD_VERBOSITY: 1
409+
CIBW_CONFIG_SETTINGS: "setup-args=-Dallow-noblas=true"
410+
CIBW_CONFIG_SETTINGS_WINDOWS: "setup-args=--vsenv setup-args=-Dallow-noblas=true"
411+
CIBW_BEFORE_BUILD_WINDOWS: "pip install delvewheel"
412+
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "delvewheel repair -w {dest_dir} {wheel}"
413+
CIBW_ENABLE: "cpython-prerelease"
414+
with:
415+
package-dir: ${{ env.NUMPY_SRC_DIR }}
416+
output-dir: numpy-wheel/
417+
418+
- name: Upload numpy wheel
419+
if: ${{ startsWith(matrix.python-version, '3.15') }}
420+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
421+
with:
422+
name: numpy-python${{ env.PYTHON_VERSION_FORMATTED }}-${{ inputs.host-platform }}
423+
path: numpy-wheel/*.whl
424+
if-no-files-found: error
425+
426+
- name: Install numpy wheel
427+
if: ${{ startsWith(matrix.python-version, '3.15') }}
428+
run: pip install numpy-wheel/*.whl
429+
368430
- name: Build cuda.bindings Cython tests
369431
run: |
370432
pip install ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}/*.whl --group ./cuda_bindings/pyproject.toml:test

.github/workflows/test-wheel-linux.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,17 @@ jobs:
271271
host-platform: ${{ inputs.host-platform }}
272272
cuda-version: ${{ matrix.CUDA_VER }}
273273

274+
- name: Download numpy wheel (pre-release Python)
275+
if: ${{ startsWith(matrix.PY_VER, '3.15') }}
276+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
277+
with:
278+
name: numpy-python${{ env.PYTHON_VERSION_FORMATTED }}-${{ inputs.host-platform }}
279+
path: numpy-wheel
280+
281+
- name: Install numpy wheel (pre-release Python)
282+
if: ${{ startsWith(matrix.PY_VER, '3.15') }}
283+
run: pip install numpy-wheel/*.whl
284+
274285
- name: Set up latest cuda_sanitizer_api
275286
if: ${{ env.SETUP_SANITIZER == '1' }}
276287
uses: ./.github/actions/fetch_ctk

.github/workflows/test-wheel-windows.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,18 @@ jobs:
262262
host-platform: ${{ inputs.host-platform }}
263263
cuda-version: ${{ matrix.CUDA_VER }}
264264

265+
- name: Download numpy wheel (pre-release Python)
266+
if: ${{ startsWith(matrix.PY_VER, '3.15') }}
267+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
268+
with:
269+
name: numpy-python${{ env.PYTHON_VERSION_FORMATTED }}-${{ inputs.host-platform }}
270+
path: numpy-wheel
271+
272+
- name: Install numpy wheel (pre-release Python)
273+
if: ${{ startsWith(matrix.PY_VER, '3.15') }}
274+
shell: bash --noprofile --norc -xeuo pipefail {0}
275+
run: pip install numpy-wheel/*.whl
276+
265277
- name: Set up test repetition on nightly runs
266278
shell: bash --noprofile --norc -xeuo pipefail {0}
267279
run: echo "PYTEST_ADDOPTS=\"--count=${{ inputs.nruns }}\"" >> "$GITHUB_ENV"

ci/tools/download-wheels

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ do
5656
continue
5757
fi
5858

59+
# exclude pre-release Python (3.15) wheels from releasing
60+
if [[ "${p}" == *python315* ]]; then
61+
echo "Skipping pre-release Python artifact: $p"
62+
continue
63+
fi
64+
5965
# If we're not downloading "all", only process matching component
6066
if [[ "$COMPONENT" != "all" && "$p" != ${COMPONENT}* ]]; then
6167
continue

0 commit comments

Comments
 (0)