Skip to content

Commit 1967715

Browse files
committed
cibuildwheel: move configuration to pyproject.toml
move the configuration to pyproject.toml, that it would be easier to use from multiple workflow and for local usage for example: ``` uv pip install cibuildwheel CIBW_FREE_THREADED_SUPPORT=True cibuildwheel --only cp313-manylinux_x86_64 ```
1 parent 4a069aa commit 1967715

File tree

3 files changed

+49
-51
lines changed

3 files changed

+49
-51
lines changed

.github/workflows/build-pre-release.yml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,7 @@ name: Build pre release python versions
33
on: [push, pull_request]
44

55
env:
6-
CIBW_TEST_COMMAND_LINUX: "pytest {project}/tests/unit"
7-
CIBW_BEFORE_TEST: "pip install -r {project}/test-requirements.txt"
8-
CIBW_BEFORE_BUILD_LINUX: "rm -rf ~/.pyxbld && rpm --import https://repo.almalinux.org/almalinux/RPM-GPG-KEY-AlmaLinux && yum install -y libffi-devel libev libev-devel openssl openssl-devel"
9-
CIBW_ENVIRONMENT: "CASS_DRIVER_BUILD_CONCURRENCY=2 CFLAGS='-g0 -O3'"
10-
CIBW_PRERELEASE_PYTHONS: True
11-
CIBW_SKIP: cp35* cp36* *musllinux*
12-
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
6+
CIBW_ENABLE: cpython-prerelease
137

148
jobs:
159
build_wheels:
@@ -32,12 +26,12 @@ jobs:
3226

3327
- name: Install cibuildwheel
3428
run: |
35-
python3 -m pip install cibuildwheel==2.22.0
29+
python3 -m pip install cibuildwheel==2.22.0 uv==0.5.23
3630
3731
- name: Overwrite for Linux 64
3832
if: runner.os == 'Linux' && matrix.platform == 'x86_64'
3933
run: |
40-
echo "CIBW_BUILD=cp313*_x86_64" >> $GITHUB_ENV
34+
echo "CIBW_BUILD=cp314*_x86_64" >> $GITHUB_ENV
4135
4236
- name: Build wheels
4337
run: |

.github/workflows/build-push.yml

Lines changed: 2 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,6 @@ name: Build and upload to PyPi
22

33
on: [push, pull_request]
44

5-
6-
env:
7-
CIBW_TEST_COMMAND_LINUX: >
8-
pytest {project}/tests/unit &&
9-
EVENT_LOOP_MANAGER=gevent pytest {project}/tests/unit/io/test_geventreactor.py
10-
11-
CIBW_TEST_COMMAND_MACOS: "pytest {project}/tests/unit -k 'not (test_multi_timer_validation or test_empty_connections or test_timer_cancellation)' "
12-
CIBW_TEST_COMMAND_WINDOWS: "pytest {project}/tests/unit -k \"not (test_deserialize_date_range_year or test_datetype or test_libevreactor)\" "
13-
CIBW_BEFORE_TEST: "pip install -r {project}/test-requirements.txt"
14-
CIBW_BEFORE_BUILD_LINUX: "rm -rf ~/.pyxbld && rpm --import https://repo.almalinux.org/almalinux/RPM-GPG-KEY-AlmaLinux && yum install -y libffi-devel libev libev-devel openssl openssl-devel"
15-
CIBW_ENVIRONMENT: "CASS_DRIVER_BUILD_CONCURRENCY=2 CASS_DRIVER_BUILD_EXTENSIONS_ARE_MUST=yes CFLAGS='-g0 -O3'"
16-
CIBW_SKIP: cp36* cp37* pp*i686 *musllinux*
17-
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
18-
CIBW_MANYLINUX_PYPY_X86_64_IMAGE: manylinux_2_28
19-
CIBW_MANYLINUX_AARCH64_IMAGE: manylinux_2_28
20-
CIBW_MANYLINUX_PYPY_AARCH64_IMAGE: manylinux_2_28
21-
CIBW_BUILD_FRONTEND: "build[uv]"
22-
235
jobs:
246
build_wheels:
257
name: Build wheels ${{ matrix.os }} (${{ matrix.platform }})
@@ -64,7 +46,7 @@ jobs:
6446
6547
- name: Install cibuildwheel
6648
run: |
67-
python3 -m pip install cibuildwheel==2.22.0
49+
python3 -m pip install cibuildwheel==2.22.0 uv==0.5.23
6850
6951
- name: Install OpenSSL for Windows
7052
if: runner.os == 'Windows'
@@ -86,41 +68,20 @@ jobs:
8668
run: |
8769
brew install libev
8870
89-
- name: Overwrite for Linux 64
90-
if: runner.os == 'Linux' && matrix.platform == 'x86_64'
91-
run: |
92-
echo "CIBW_BUILD=cp3*_x86_64" >> $GITHUB_ENV
93-
9471
- name: Overwrite for Linux PyPy
9572
if: runner.os == 'Linux' && matrix.platform == 'PyPy'
9673
run: |
9774
echo "CIBW_BUILD=pp*" >> $GITHUB_ENV
98-
echo "CIBW_TEST_COMMAND_LINUX=" >> $GITHUB_ENV
99-
100-
- name: Overwrite for Windows 64
101-
if: runner.os == 'Windows' && matrix.platform == 'win64'
102-
run: |
103-
echo "CIBW_BUILD=cp*win_amd64" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
10475
10576
- name: Overwrite for Windows PyPY
10677
if: runner.os == 'Windows' && matrix.platform == 'PyPy'
10778
run: |
10879
echo "CIBW_BUILD=pp*" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
109-
echo "CIBW_TEST_COMMAND_WINDOWS=" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
110-
111-
- name: Overwrite for MacOs
112-
if: runner.os == 'MacOs' && matrix.platform == 'all'
113-
run: |
114-
echo "CIBW_BUILD=cp39* cp310* cp311* cp312* cp313*" >> $GITHUB_ENV
115-
echo "CIBW_BEFORE_TEST_MACOS=pip install -r {project}/test-requirements.txt pytest" >> $GITHUB_ENV
116-
echo "MACOSX_DEPLOYMENT_TARGET=13.0" >> $GITHUB_ENV
11780
11881
- name: Overwrite for MacOs PyPy
11982
if: runner.os == 'MacOs' && matrix.platform == 'PyPy'
12083
run: |
12184
echo "CIBW_BUILD=pp*" >> $GITHUB_ENV
122-
echo "CIBW_BEFORE_TEST_MACOS=pip install -r {project}/test-requirements.txt pytest" >> $GITHUB_ENV
123-
echo "CIBW_TEST_COMMAND_MACOS=" >> $GITHUB_ENV
12485
12586
- name: Build wheels
12687
run: |
@@ -178,7 +139,7 @@ jobs:
178139

179140
- name: Install cibuildwheel
180141
run: |
181-
python -m pip install cibuildwheel==2.22.0
142+
python -m pip install cibuildwheel==2.22.0 uv==0.5.23
182143
183144
- name: Build wheels
184145
env:

pyproject.toml

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,47 @@ requires = [
7878
"Cython",
7979
]
8080

81-
build-backend = "setuptools.build_meta"
81+
build-backend = "setuptools.build_meta"
82+
83+
#### CI BUILDWHEEL CONFIG ####
84+
85+
[tool.cibuildwheel]
86+
87+
build-frontend = "build[uv]"
88+
environment = { CASS_DRIVER_BUILD_CONCURRENCY = "2", CASS_DRIVER_BUILD_EXTENSIONS_ARE_MUST = "yes", CFLAGS = "-g0 -O3" }
89+
skip = ["cp36*", "cp37*", "pp*i686", "*musllinux*"]
90+
91+
before-test = "pip install -r {project}/test-requirements.txt"
92+
93+
[tool.cibuildwheel.linux]
94+
build = ["cp3*_x86_64"]
95+
96+
before-build = "rm -rf ~/.pyxbld && rpm --import https://repo.almalinux.org/almalinux/RPM-GPG-KEY-AlmaLinux && yum install -y libffi-devel libev libev-devel openssl openssl-devel"
97+
test-command = [
98+
"pytest {package}/tests/unit",
99+
"EVENT_LOOP_MANAGER=gevent pytest {package}/tests/unit/io/test_geventreactor.py",
100+
]
101+
manylinux-x86_64-image = "manylinux_2_28"
102+
manylinux-aarch64-image = "manylinux_2_28"
103+
104+
[tool.cibuildwheel.macos]
105+
build = ["cp39*", "cp310*", "cp311*", "cp312*", "cp313*"]
106+
107+
[tool.cibuildwheel.windows]
108+
build = ["cp3*_amd64"]
109+
build-frontend = "build" # build[uv] seems to be broken on Windows
110+
111+
[[tool.cibuildwheel.overrides]]
112+
select = "*-macosx_*"
113+
inherit.environment = "append"
114+
environment = { MACOSX_DEPLOYMENT_TARGET = "13.0" }
115+
116+
[[tool.cibuildwheel.overrides]]
117+
select = "pp*-manylinux*"
118+
test-command = []
119+
manylinux-pypy_x86_64-image = "manylinux_2_28"
120+
manylinux-pypy_aarch64-image = "manylinux_2_28"
121+
122+
[[tool.cibuildwheel.overrides]]
123+
select = 'pp*win_amd64'
124+
test-command = []

0 commit comments

Comments
 (0)