Skip to content

Commit c4941bb

Browse files
committed
Move cibuildwheel configuration to pyproject.toml
This allows developers to test out the build locally. With this, I was able to fix the test command by setting `PIP_PREFER_BINARY` to avoid re-building Pillow, which accidentally dropped manylinux2014 wheels in the latest release: python-pillow/Pillow#9057 Note also that we previously set `CIBW_AFTER_BUILD`, but this doesn't seem to be a valid setting. Thus I have dropped the `twine check`, which only tests the `README` rendering and so checking the sdist is sufficient. Additionally, I have commented out the license check, as we cannot do multiple licenses with meson-python without PEP639 (matplotlib#28982).
1 parent 7266008 commit c4941bb

File tree

3 files changed

+42
-29
lines changed

3 files changed

+42
-29
lines changed

.github/labeler.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
---
22
"CI: Run cibuildwheel":
33
- changed-files:
4-
- any-glob-to-any-file: ['.github/workflows/cibuildwheel.yml']
4+
- any-glob-to-any-file:
5+
- '.github/workflows/cibuildwheel.yml'
6+
- 'pyproject.toml'
57
"CI: Run cygwin":
68
- changed-files:
79
- any-glob-to-any-file: ['.github/workflows/cygwin.yml']

.github/workflows/cibuildwheel.yml

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -94,31 +94,6 @@ jobs:
9494
needs: build_sdist
9595
name: Build wheels on ${{ matrix.os }} for ${{ matrix.cibw_archs }}
9696
runs-on: ${{ matrix.os }}
97-
env:
98-
CIBW_BEFORE_BUILD: >-
99-
rm -rf {package}/build
100-
CIBW_BEFORE_BUILD_WINDOWS: >-
101-
pip install delvewheel &&
102-
rm -rf {package}/build
103-
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: >-
104-
delvewheel repair -w {dest_dir} {wheel}
105-
CIBW_AFTER_BUILD: >-
106-
twine check {wheel} &&
107-
python {package}/ci/check_wheel_licenses.py {wheel}
108-
# On Windows, we explicitly request MSVC compilers (as GitHub Action runners have
109-
# MinGW on PATH that would be picked otherwise), switch to a static build for
110-
# runtimes, but use dynamic linking for `VCRUNTIME140.dll`, `VCRUNTIME140_1.dll`,
111-
# and the UCRT. This avoids requiring specific versions of `MSVCP140.dll`, while
112-
# keeping shared state with the rest of the Python process/extensions.
113-
CIBW_CONFIG_SETTINGS_WINDOWS: >-
114-
setup-args="--vsenv"
115-
setup-args="-Db_vscrt=mt"
116-
setup-args="-Dcpp_link_args=['ucrt.lib','vcruntime.lib','/nodefaultlib:libucrt.lib','/nodefaultlib:libvcruntime.lib']"
117-
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
118-
CIBW_SKIP: "*-musllinux_aarch64"
119-
CIBW_TEST_COMMAND: >-
120-
python {package}/ci/check_version_number.py
121-
MACOSX_DEPLOYMENT_TARGET: "10.12"
12297
strategy:
12398
matrix:
12499
include:
@@ -148,17 +123,15 @@ jobs:
148123
package-dir: dist/${{ needs.build_sdist.outputs.SDIST_NAME }}
149124
env:
150125
CIBW_BUILD: "cp314-* cp314t-*"
151-
CIBW_ENABLE: "cpython-freethreading cpython-prerelease"
126+
CIBW_ENABLE: "cpython-prerelease"
152127
CIBW_ARCHS: ${{ matrix.cibw_archs }}
153-
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
154128

155129
- name: Build wheels for CPython 3.13
156130
uses: pypa/cibuildwheel@c923d83ad9c1bc00211c5041d0c3f73294ff88f6 # v3.1.4
157131
with:
158132
package-dir: dist/${{ needs.build_sdist.outputs.SDIST_NAME }}
159133
env:
160134
CIBW_BUILD: "cp313-* cp313t-*"
161-
CIBW_ENABLE: cpython-freethreading
162135
CIBW_ARCHS: ${{ matrix.cibw_archs }}
163136

164137
- name: Build wheels for CPython 3.12

pyproject.toml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,44 @@ local_scheme = "node-and-date"
8686
parentdir_prefix_version = "matplotlib-"
8787
fallback_version = "0.0+UNKNOWN"
8888

89+
[tool.cibuildwheel]
90+
enable = ["cpython-freethreading"]
91+
skip = "*-musllinux_aarch64"
92+
manylinux-x86_64-image = "manylinux2014"
93+
94+
before-build = "rm -rf {package}/build"
95+
test-command = [
96+
# "python {package}/ci/check_wheel_licenses.py {wheel}",
97+
"python {package}/ci/check_version_number.py",
98+
]
99+
test-environment = "PIP_PREFER_BINARY=true"
100+
101+
[tool.cibuildwheel.macos.environment]
102+
MACOSX_DEPLOYMENT_TARGET = "10.12"
103+
104+
[tool.cibuildwheel.windows]
105+
before-build = [
106+
"pip install delvewheel",
107+
"rm -rf {package}/build",
108+
]
109+
repair-wheel-command = "delvewheel repair -w {dest_dir} {wheel}"
110+
111+
[tool.cibuildwheel.windows.config-settings]
112+
# On Windows, we explicitly request MSVC compilers (as GitHub Action runners have
113+
# MinGW on PATH that would be picked otherwise), switch to a static build for
114+
# runtimes, but use dynamic linking for `VCRUNTIME140.dll`, `VCRUNTIME140_1.dll`,
115+
# and the UCRT. This avoids requiring specific versions of `MSVCP140.dll`, while
116+
# keeping shared state with the rest of the Python process/extensions.
117+
setup-args = [
118+
"--vsenv",
119+
"-Db_vscrt=mt",
120+
"-Dcpp_link_args=['ucrt.lib','vcruntime.lib','/nodefaultlib:libucrt.lib','/nodefaultlib:libvcruntime.lib']",
121+
]
122+
123+
[[tool.cibuildwheel.overrides]]
124+
select = "cp314*"
125+
manylinux-x86_64-image = "manylinux_2_28"
126+
89127
[tool.isort]
90128
known_pydata = "numpy, matplotlib.pyplot"
91129
known_firstparty = "matplotlib,mpl_toolkits"

0 commit comments

Comments
 (0)