Skip to content

Commit 40efd83

Browse files
committed
Force use of numpy 1.26
1 parent e81babc commit 40efd83

File tree

1 file changed

+30
-7
lines changed

1 file changed

+30
-7
lines changed

.github/workflows/build.yml

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,28 @@ jobs:
1515
CIBW_ARCHS_LINUX: ${{ matrix.arch }}
1616
CIBW_ARCHS_MACOS: "x86_64 arm64"
1717
CIBW_ENABLE: cpython-freethreading
18+
# Ensure cibuildwheel uses correct NumPy in isolated builds too
19+
CIBW_BEFORE_BUILD: |
20+
pip install --upgrade pip
21+
if [ -n "${{ matrix.numpy-version }}" ]; then
22+
pip install --force-reinstall "numpy==${{ matrix.numpy-version }}.*"
23+
else
24+
pip install --upgrade numpy
25+
fi
26+
python -c "import numpy; print('Using NumPy', numpy.__version__)"
1827
strategy:
1928
fail-fast: false
2029
matrix:
2130
include:
22-
# Linux x86_64 builds
31+
# Linux x86_64 builds (latest NumPy)
2332
- os: ubuntu-latest
2433
arch: x86_64
2534
artifact_name: "linux-x86_64"
2635

27-
# Linux x86_64 with numpy 1.23
36+
# Linux x86_64 with NumPy 1.26
2837
- os: ubuntu-latest
2938
arch: x86_64
30-
artifact_name: "linux-x86_64_numpy1_23"
39+
artifact_name: "linux-x86_64_numpy1_26"
3140
numpy-version: "1.26"
3241

3342
# Linux ARM64 builds (native runners)
@@ -44,17 +53,31 @@ jobs:
4453
- os: macos-latest
4554
arch: x86_64
4655
artifact_name: "macos-universal2"
56+
4757
steps:
4858
- uses: actions/checkout@v3
4959

50-
- uses: actions/setup-python@v3
51-
name: Install Python
60+
- name: Install Python
61+
uses: actions/setup-python@v5
5262
with:
5363
python-version: '3.12'
64+
cache: false
5465

55-
- name: Install specific numpy version
66+
- name: Install specific NumPy version
5667
if: matrix.numpy-version
57-
run: pip install "numpy==${{ matrix.numpy-version }}.*"
68+
run: |
69+
pip install --upgrade pip
70+
pip install --force-reinstall "numpy==${{ matrix.numpy-version }}.*"
71+
python -c "import numpy; print('Installed NumPy version:', numpy.__version__)"
72+
shell: bash
73+
74+
- name: Ensure latest NumPy if not pinned
75+
if: ${{ !matrix.numpy-version }}
76+
run: |
77+
pip install --upgrade pip
78+
pip install --upgrade numpy
79+
python -c "import numpy; print('Using latest NumPy:', numpy.__version__)"
80+
shell: bash
5881

5982
- name: Build wheels
6083
uses: pypa/cibuildwheel@v3.1.3

0 commit comments

Comments
 (0)