Skip to content

Commit 8dc2d1a

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 40516e8 commit 8dc2d1a

File tree

3 files changed

+44
-31
lines changed

3 files changed

+44
-31
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: 0 additions & 30 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,11 +123,6 @@ jobs:
148123
CIBW_BUILD: "cp314-* cp314t-*"
149124
CIBW_ENABLE: "cpython-freethreading cpython-prerelease"
150125
CIBW_ARCHS: ${{ matrix.cibw_archs }}
151-
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
152-
CIBW_BEFORE_TEST: >-
153-
python -m pip install
154-
--index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple
155-
--upgrade --pre --only-binary=:all: contourpy numpy pillow
156126

157127
- name: Build wheels for CPython 3.13
158128
uses: pypa/cibuildwheel@5f22145df44122af0f5a201f93cf0207171beca7 # v3.0.0

pyproject.toml

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

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

0 commit comments

Comments
 (0)