Skip to content

Commit 3f1f3c0

Browse files
leofangclaude
andcommitted
Fix numpy cibuildwheel: patch cpython-freethreading, unify platforms
- Patch numpy 2.4.x pyproject.toml to remove the "cpython-freethreading" enable group, which is invalid in cibuildwheel v4.0 (fixed on numpy main but not yet released). - Consolidate Linux/Windows numpy builds into a single cibuildwheel step, matching how cuda.core and cuda.bindings are built. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent ee8db04 commit 3f1f3c0

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

.github/workflows/build-wheel.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -257,30 +257,31 @@ jobs:
257257
mv "/c/Program Files/Git/usr/bin/link.exe" "/c/Program Files/Git/usr/bin/link.exe.bak"
258258
fi
259259
260-
- name: Download numpy sdist (pre-release Python)
261-
if: ${{ startsWith(matrix.python-version, '3.15') && startsWith(inputs.host-platform, 'linux') }}
260+
- name: Download and patch numpy sdist (pre-release Python)
261+
if: ${{ startsWith(matrix.python-version, '3.15') }}
262262
run: |
263263
pip download --no-binary numpy --no-deps "numpy>=1.21.1" -d numpy-sdist/
264264
cd numpy-sdist && tar xf numpy-*.tar.gz && rm numpy-*.tar.gz
265+
# WAR: numpy 2.4.x ships enable=["cpython-freethreading", ...] which
266+
# is invalid in cibuildwheel v4.0 (freethreading is now on by default).
267+
# Fixed on numpy main (a5df4859) but not yet released.
268+
sed -i 's/"cpython-freethreading", //' numpy-*/pyproject.toml
265269
echo "NUMPY_SRC_DIR=$(pwd)/$(ls -d numpy-*/)" >> $GITHUB_ENV
266270
267-
- name: Build numpy wheel (pre-release Python, Linux)
268-
if: ${{ startsWith(matrix.python-version, '3.15') && startsWith(inputs.host-platform, 'linux') }}
271+
- name: Build numpy wheel (pre-release Python)
272+
if: ${{ startsWith(matrix.python-version, '3.15') }}
269273
uses: pypa/cibuildwheel@54327ab9d35de03b359ac25c97de9417d94639c0 # v4.0.0rc1
270274
env:
271275
CIBW_BUILD: ${{ env.CIBW_BUILD }}
272276
CIBW_ARCHS_LINUX: "native"
273277
CIBW_BUILD_VERBOSITY: 1
278+
CIBW_BEFORE_BUILD_WINDOWS: "pip install delvewheel"
279+
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "delvewheel repair -w {dest_dir} {wheel}"
274280
CIBW_ENABLE: "cpython-prerelease"
275281
with:
276282
package-dir: ${{ env.NUMPY_SRC_DIR }}
277283
output-dir: numpy-wheel/
278284

279-
- name: Build numpy wheel (pre-release Python, Windows)
280-
if: ${{ startsWith(matrix.python-version, '3.15') && startsWith(inputs.host-platform, 'win') }}
281-
run: |
282-
pip wheel "numpy>=1.21.1" --no-binary numpy -w numpy-wheel/
283-
284285
- name: Upload numpy wheel
285286
if: ${{ startsWith(matrix.python-version, '3.15') }}
286287
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1

0 commit comments

Comments
 (0)