Skip to content

Commit fe33cb8

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 c68898b commit fe33cb8

File tree

3 files changed

+54
-57
lines changed

3 files changed

+54
-57
lines changed

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

+4-9
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,8 @@ 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
7+
CIBW_ALLOW_EMPTY: True
138

149
jobs:
1510
build_wheels:
@@ -32,12 +27,12 @@ jobs:
3227

3328
- name: Install cibuildwheel
3429
run: |
35-
python3 -m pip install cibuildwheel==2.22.0
30+
python3 -m pip install cibuildwheel==2.22.0 uv==0.5.23
3631
3732
- name: Overwrite for Linux 64
3833
if: runner.os == 'Linux' && matrix.platform == 'x86_64'
3934
run: |
40-
echo "CIBW_BUILD=cp313*_x86_64" >> $GITHUB_ENV
35+
echo "CIBW_BUILD=cp314*" >> $GITHUB_ENV
4136
4237
- name: Build wheels
4338
run: |

.github/workflows/build-push.yml

+11-47
Original file line numberDiff line numberDiff line change
@@ -2,23 +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-
225
jobs:
236
build_wheels:
247
name: Build wheels ${{ matrix.os }} (${{ matrix.platform }})
@@ -63,7 +46,7 @@ jobs:
6346
6447
- name: Install cibuildwheel
6548
run: |
66-
python3 -m pip install cibuildwheel==2.22.0
49+
python3 -m pip install cibuildwheel==2.22.0 uv==0.5.23
6750
6851
- name: Install OpenSSL for Windows
6952
if: runner.os == 'Windows'
@@ -85,49 +68,30 @@ jobs:
8568
run: |
8669
brew install libev
8770
88-
- name: Overwrite for Linux 64
89-
if: runner.os == 'Linux' && matrix.platform == 'x86_64'
90-
run: |
91-
echo "CIBW_BUILD=cp3*_x86_64" >> $GITHUB_ENV
92-
9371
- name: Overwrite for Linux PyPy
9472
if: runner.os == 'Linux' && matrix.platform == 'PyPy'
9573
run: |
9674
echo "CIBW_BUILD=pp*" >> $GITHUB_ENV
97-
echo "CIBW_TEST_COMMAND_LINUX=" >> $GITHUB_ENV
98-
99-
- name: Overwrite for Windows 64
100-
if: runner.os == 'Windows' && matrix.platform == 'win64'
101-
run: |
102-
echo "CIBW_BUILD=cp*win_amd64" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
103-
echo "CIBW_ENVIRONMENT_WINDOWS= CC=clang CXX=clang++" | 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
11080
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-
if [ "${{ matrix.os }}" == "macos-13" ]; then
117-
echo "MACOSX_DEPLOYMENT_TARGET=13.0" >> $GITHUB_ENV;
118-
echo "Enforcing target deployment for 13.0"
119-
elif [ "${{ matrix.os }}" == "macos-14" ]; then
120-
echo "MACOSX_DEPLOYMENT_TARGET=14.0" >> $GITHUB_ENV;
121-
echo "Enforcing target deployment for 14.0"
122-
else
123-
echo "Unknown macos version" && false;
124-
fi
12581
- name: Overwrite for MacOs PyPy
12682
if: runner.os == 'MacOs' && matrix.platform == 'PyPy'
12783
run: |
12884
echo "CIBW_BUILD=pp*" >> $GITHUB_ENV
129-
echo "CIBW_BEFORE_TEST_MACOS=pip install -r {project}/test-requirements.txt pytest" >> $GITHUB_ENV
130-
echo "CIBW_TEST_COMMAND_MACOS=" >> $GITHUB_ENV
85+
86+
- name: Overwrite for macos-13
87+
if: matrix.os == 'macos-13' && matrix.platform == 'all'
88+
run: |
89+
echo "MACOSX_DEPLOYMENT_TARGET=13.0" >> $GITHUB_ENV
90+
91+
- name: Overwrite for macos-latest
92+
if: matrix.os == 'macos-latest' && matrix.platform == 'all'
93+
run: |
94+
echo "MACOSX_DEPLOYMENT_TARGET=14.0" >> $GITHUB_ENV
13195
13296
- name: Build wheels
13397
run: |

pyproject.toml

+39-1
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,42 @@ 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 = "pp*-manylinux*"
113+
test-command = []
114+
manylinux-pypy_x86_64-image = "manylinux_2_28"
115+
manylinux-pypy_aarch64-image = "manylinux_2_28"
116+
117+
[[tool.cibuildwheel.overrides]]
118+
select = 'pp*win_amd64'
119+
test-command = []

0 commit comments

Comments
 (0)