Skip to content

Commit 1249fc5

Browse files
committed
ci: use uv + cibuildwheel to build all wheels
Previously, wheel builds were a combination of using `cibuildwheel` and `pip wheel`. On Linux, we manually spawned a container image and provided our own script for building the wheel. This commit standardizes on using `cibuildwheel` everywhere. We run `cibuildwheel` via `uv` as a dependency package so behavior is more deterministic. Except for the musllinux emulated builds, where uv isn't available.
1 parent a03989b commit 1249fc5

File tree

6 files changed

+110
-154
lines changed

6 files changed

+110
-154
lines changed

.github/workflows/wheel.yml

Lines changed: 97 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -10,50 +10,84 @@ jobs:
1010
fail-fast: false
1111

1212
matrix:
13-
image:
14-
- 'manylinux2014_aarch64'
15-
- 'musllinux_1_1_aarch64'
16-
- 'musllinux_1_2_aarch64'
17-
- 'manylinux2014_i686'
18-
- 'musllinux_1_2_i686'
19-
- 'manylinux2014_ppc64le'
20-
- 'musllinux_1_2_ppc64le'
21-
- 'manylinux2014_s390x'
22-
- 'musllinux_1_2_s390x'
23-
- 'manylinux2014_x86_64'
24-
- 'musllinux_1_1_x86_64'
25-
- 'musllinux_1_2_x86_64'
2613
py:
27-
- 'cp39-cp39'
28-
- 'cp310-cp310'
29-
- 'cp311-cp311'
30-
- 'cp312-cp312'
31-
- 'cp313-cp313'
32-
- 'cp314-cp314'
14+
- 'cp39'
15+
- 'cp310'
16+
- 'cp311'
17+
- 'cp312'
18+
- 'cp313'
19+
- 'cp314'
20+
arch:
21+
- 'aarch64'
22+
- 'i686'
23+
- 'ppc64le'
24+
- 's390x'
25+
- 'x86_64'
26+
abi:
27+
- 'manylinux'
28+
- 'musllinux'
29+
image:
30+
- 'manylinux2014'
31+
- 'musllinux_1_1'
32+
- 'musllinux_1_2'
3333
exclude:
34-
- image: 'musllinux_1_1_aarch64'
35-
py: 'cp314-cp314'
36-
- image: 'musllinux_1_1_x86_64'
37-
py: 'cp314-cp314'
38-
runs-on: ${{ endsWith(matrix.image, 'aarch64') && 'ubuntu-22.04-arm' || 'ubuntu-22.04' }}
34+
# Cancel out abi - image mismatch.
35+
- abi: 'manylinux'
36+
image: 'musllinux_1_1'
37+
- abi: 'manylinux'
38+
image: 'musllinux_1_2'
39+
- abi: 'musllinux'
40+
image: 'manylinux2014'
41+
# Remove some older ABIs that don't need to exist.
42+
- arch: 'i686'
43+
image: 'musllinux_1_1'
44+
- arch: 'ppc64le'
45+
image: 'musllinux_1_1'
46+
- arch: 's390x'
47+
image: 'musllinux_1_1'
48+
# Drop support for musllinux_1_1 on 3.14+
49+
- py: 'cp314'
50+
image: 'musllinux_1_1'
51+
runs-on: ${{ matrix.arch == 'aarch64' && 'ubuntu-22.04-arm' || 'ubuntu-22.04' }}
52+
env:
53+
CIBW_ARCHS: ${{ matrix.arch }}
54+
CIBW_BUILD: ${{ matrix.py }}-${{ matrix.abi }}_${{ matrix.arch }}
55+
# uv not present on musllinux cross-compiled images.
56+
CIBW_BUILD_FRONTEND: ${{ (matrix.abi == 'musllinux' && (matrix.arch == 'ppc64le' || matrix.arch == 's390x')) && 'build' || 'build[uv]' }}
57+
CIBW_BUILD_VERBOSITY: '1'
58+
CIBW_MANYLINUX_AARCH64_IMAGE: quay.io/pypa/${{ matrix.image }}_aarch64:latest
59+
CIBW_MANYLINUX_I686_IMAGE: quay.io/pypa/${{ matrix.image }}_i686:latest
60+
CIBW_MANYLINUX_PPC64LE_IMAGE: quay.io/pypa/${{ matrix.image }}_ppc64le:latest
61+
CIBW_MANYLINUX_S390X_IMAGE: quay.io/pypa/${{ matrix.image }}_s390x:latest
62+
CIBW_MANYLINUX_X86_64_IMAGE: quay.io/pypa/${{ matrix.image }}_x86_64:latest
63+
CIBW_MUSLLINUX_AARCH64_IMAGE: quay.io/pypa/${{ matrix.image }}_aarch64:latest
64+
CIBW_MUSLLINUX_I686_IMAGE: quay.io/pypa/${{ matrix.image }}_i686:latest
65+
CIBW_MUSLLINUX_PPC64LE_IMAGE: quay.io/pypa/${{ matrix.image }}_ppc64le:latest
66+
CIBW_MUSLLINUX_S390X_IMAGE: quay.io/pypa/${{ matrix.image }}_s390x:latest
67+
CIBW_MUSLLINUX_X86_64_IMAGE: quay.io/pypa/${{ matrix.image }}_x86_64:latest
3968
steps:
4069
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
4170
with:
4271
persist-credentials: false
4372

73+
- name: Install uv
74+
uses: astral-sh/setup-uv@d9e0f98d3fc6adb07d1e3d37f3043649ddad06a1 # v6.5.0
75+
with:
76+
version: "0.8.11"
77+
4478
- name: Set up QEMU
45-
if: ${{ endsWith(matrix.image, 'ppc64le') || endsWith(matrix.image, 's390x') }}
79+
if: ${{ matrix.arch == 'ppc64le' || matrix.arch == 's390x' }}
4680
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
4781

48-
- name: Build Wheel
82+
- name: Build wheels
4983
run: |
50-
docker run -e PYPATH=/opt/python/${{ matrix.py }} -e ZSTD_WARNINGS_AS_ERRORS=1 --rm -v `pwd`:/project quay.io/pypa/${{ matrix.image }} /project/ci/build-manylinux-wheel.sh
84+
uvx -p 3.13 [email protected]
5185
5286
- name: Upload Wheel
5387
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
5488
with:
55-
name: linux-${{ matrix.py }}-${{ matrix.image }}
56-
path: dist
89+
name: linux-${{ matrix.py }}-${{ matrix.arch }}-${{ matrix.abi }}-${{ matrix.image }}
90+
path: ./wheelhouse/*.whl
5791

5892
macos:
5993
strategy:
@@ -71,77 +105,70 @@ jobs:
71105
- 'x86_64'
72106
runs-on: ${{ matrix.arch == 'x86_64' && 'macos-13' || 'macos-14' }}
73107
env:
74-
CIBW_ARCHS: ${{ matrix.arch }}
75-
CIBW_BUILD: ${{ matrix.py }}-*
108+
CIBW_ARCHES: ${{ matrix.arch }}
109+
CIBW_BUILD: ${{ matrix.py }}-macosx_${{ matrix.arch }}
76110
CIBW_BUILD_VERBOSITY: '1'
77-
ZSTD_WARNINGS_AS_ERRORS: '1'
78111
steps:
79-
- name: Set up Python
80-
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
81-
with:
82-
python-version: '3.13'
83-
84112
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
85113
with:
86114
persist-credentials: false
87115

88-
- name: Install Dependencies
89-
run: |
90-
python -m pip install --require-hashes -r ci/requirements.macoswheels.txt
116+
- name: Install uv
117+
uses: astral-sh/setup-uv@d9e0f98d3fc6adb07d1e3d37f3043649ddad06a1 # v6.5.0
118+
with:
119+
version: "0.8.11"
91120

92-
- name: Build Wheel
121+
- name: Build wheels
93122
run: |
94-
cibuildwheel --output-dir dist
123+
uvx -p 3.13 [email protected]
95124
96125
- name: Upload Wheel
97126
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
98127
with:
99128
name: macos-${{ matrix.py }}-${{ matrix.arch }}
100-
path: dist
129+
path: ./wheelhouse/*.whl
101130

102131
windows:
103132
strategy:
104133
fail-fast: false
105134
matrix:
106135
py:
107-
- '3.9'
108-
- '3.10'
109-
- '3.11'
110-
- '3.12'
111-
- '3.13'
112-
- '3.14'
136+
- 'cp39'
137+
- 'cp310'
138+
- 'cp311'
139+
- 'cp312'
140+
- 'cp313'
141+
- 'cp314'
113142
arch:
114-
- 'x86'
115-
- 'x64'
116-
- 'arm64'
143+
- 'win32'
144+
- 'win_amd64'
145+
- 'win_arm64'
117146
exclude:
118-
- py: '3.8'
119-
arch: 'arm64'
120-
- py: '3.9'
121-
arch: 'arm64'
122-
- py: '3.10'
123-
arch: 'arm64'
124-
runs-on: ${{ matrix.arch == 'arm64' && 'windows-11-arm' || 'windows-2022' }}
147+
- py: 'cp39'
148+
arch: 'win_arm64'
149+
- py: 'cp310'
150+
arch: 'win_arm64'
151+
runs-on: ${{ matrix.arch == 'win_arm64' && 'windows-11-arm' || 'windows-2022' }}
125152
env:
126-
ZSTD_WARNINGS_AS_ERRORS: '1'
153+
CIBW_ARCHES: ${{ matrix.arch }}
154+
CIBW_BUILD: ${{ matrix.py }}-${{ matrix.arch }}
155+
CIBW_BUILD_VERBOSITY: '1'
127156
steps:
128-
- name: Set up Python
129-
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
130-
with:
131-
python-version: ${{ matrix.py }}
132-
architecture: ${{ matrix.arch }}
133-
allow-prereleases: true
134-
135157
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
136158
with:
137159
persist-credentials: false
138160

139-
- name: Build Wheel
161+
- name: Install uv
162+
uses: astral-sh/setup-uv@d9e0f98d3fc6adb07d1e3d37f3043649ddad06a1 # v6.5.0
163+
with:
164+
version: "0.8.11"
165+
166+
- name: Build wheels
140167
run: |
141-
python -m pip wheel -w dist .
168+
uvx -p 3.13 [email protected]
142169
143170
- name: Upload Wheel
144171
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
145172
with:
146173
name: windows-${{ matrix.py }}-${{ matrix.arch }}
147-
path: dist
174+
path: ./wheelhouse/*.whl

ci/build-manylinux-wheel.sh

Lines changed: 0 additions & 26 deletions
This file was deleted.

ci/requirements.macoswheels.in

Lines changed: 0 additions & 1 deletion
This file was deleted.

ci/requirements.macoswheels.txt

Lines changed: 0 additions & 57 deletions
This file was deleted.

docs/news.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ Version History
1212
This fixes a nogil / multi-threaded compile error. (#201, #275)
1313
* A zstandard commit to fix qsort detection on BSD operating systems
1414
has been backported. (#272)
15+
* The CI jobs for building wheels have been overhauled to always use
16+
`cibuildwheel` and `uv` (where possible). This change should be backwards
17+
compatible. But wheel building for this project has historically been
18+
fragile and there may be unwanted changes. We're optimistic that standardizing
19+
on uv (except for musllinux ppc64le and s390x where uv isn't available)
20+
will lead to more stability over time.
1521

1622
0.24.0 (released 2025-08-17)
1723
============================

pyproject.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ select = ["E4", "E7", "E9", "F", "I"]
6060

6161
[tool.cibuildwheel]
6262
enable = ["cpython-prerelease"]
63+
build-frontend = "build[uv]"
64+
65+
# Turn compiler warnings into errors.
66+
environment = "ZSTD_WARNINGS_AS_ERRORS=1"
67+
68+
[tool.cibuildwheel.linux]
69+
before-all = "if [ -x /usr/bin/yum ]; then yum install -y libffi-devel; fi"
6370

6471
# This is needed to suppress generation of license-file, which isn't
6572
# compatible with metadata version 2.1, which our pinned setuptools

0 commit comments

Comments
 (0)