Skip to content

Commit e816e6a

Browse files
committed
Merge branch 'main' into enable-legacy-removal
2 parents 9a0240f + a96545b commit e816e6a

35 files changed

+554
-177
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
path: dist
3434

3535
- name: Generate artifact attestation for sdist and wheel
36-
uses: actions/attest-build-provenance@ef244123eb79f2f7a7e75d99086184180e6d0018 # v1.4.4
36+
uses: actions/attest-build-provenance@7668571508540a607bdfd90a87a560489fe372eb # v2.1.0
3737
with:
3838
subject-path: "dist/cibuildwheel-*"
3939

.github/workflows/test.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
python-version: ${{ matrix.python_version }}
5252
allow-prereleases: true
5353

54-
- uses: astral-sh/setup-uv@v4
54+
- uses: astral-sh/setup-uv@v5
5555

5656
# free some space to prevent reaching GHA disk space limits
5757
- name: Clean docker images
@@ -136,7 +136,7 @@ jobs:
136136
- uses: actions/setup-python@v5
137137
with:
138138
python-version: "3.x"
139-
- uses: astral-sh/setup-uv@v4
139+
- uses: astral-sh/setup-uv@v5
140140
- name: Install dependencies
141141
run: uv sync --no-dev --group test
142142
- name: Get qemu emulated architectures
@@ -159,7 +159,7 @@ jobs:
159159
- uses: actions/setup-python@v5
160160
with:
161161
python-version: "3.x"
162-
- uses: astral-sh/setup-uv@v4
162+
- uses: astral-sh/setup-uv@v5
163163
- name: Install dependencies
164164
run: uv sync --no-dev --group test
165165

@@ -180,7 +180,7 @@ jobs:
180180
name: Install Python 3.12
181181
with:
182182
python-version: '3.12'
183-
- uses: astral-sh/setup-uv@v4
183+
- uses: astral-sh/setup-uv@v5
184184

185185
- name: Install dependencies
186186
run: uv sync --no-dev --group test

.github/workflows/update-dependencies.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ jobs:
3333
- uses: actions/checkout@v4
3434

3535
- uses: wntrblm/[email protected]
36-
with:
37-
python-versions: "3.7, 3.8, 3.9, 3.10, 3.11, 3.12, 3.13"
3836

3937
- name: "Run update: dependencies"
4038
run: nox --force-color -s update_constraints

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ repos:
1414
- id: trailing-whitespace
1515

1616
- repo: https://github.com/astral-sh/ruff-pre-commit
17-
rev: v0.8.4
17+
rev: v0.8.6
1818
hooks:
1919
- id: ruff
2020
args: ["--fix", "--show-fixes"]
2121
- id: ruff-format
2222

2323
- repo: https://github.com/pre-commit/mirrors-mypy
24-
rev: v1.14.0
24+
rev: v1.14.1
2525
hooks:
2626
- id: mypy
2727
name: mypy 3.11 on cibuildwheel/

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ Options
143143
| | [`CIBW_DEPENDENCY_VERSIONS`](https://cibuildwheel.pypa.io/en/stable/options/#dependency-versions) | Specify how cibuildwheel controls the versions of the tools it uses |
144144
| **Testing** | [`CIBW_TEST_COMMAND`](https://cibuildwheel.pypa.io/en/stable/options/#test-command) | Execute a shell command to test each built wheel |
145145
| | [`CIBW_BEFORE_TEST`](https://cibuildwheel.pypa.io/en/stable/options/#before-test) | Execute a shell command before testing each wheel |
146+
| | [`CIBW_TEST_SOURCES`](https://cibuildwheel.pypa.io/en/stable/options/#test-sources) | Files and folders from the source tree that are copied into an isolated tree before running the tests |
146147
| | [`CIBW_TEST_REQUIRES`](https://cibuildwheel.pypa.io/en/stable/options/#test-requires) | Install Python dependencies before running the tests |
147148
| | [`CIBW_TEST_EXTRAS`](https://cibuildwheel.pypa.io/en/stable/options/#test-extras) | Install your wheel for testing using extras_require |
148149
| | [`CIBW_TEST_SKIP`](https://cibuildwheel.pypa.io/en/stable/options/#test-skip) | Skip running tests on some builds |

cibuildwheel/linux.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@
2121
from .util import (
2222
BuildFrontendConfig,
2323
BuildSelector,
24+
copy_test_sources,
2425
find_compatible_wheel,
2526
get_build_verbosity_extra_flags,
2627
prepare_command,
2728
read_python_configs,
2829
split_config_settings,
29-
test_fail_cwd_file,
3030
unwrap,
3131
)
3232

@@ -401,9 +401,19 @@ def build_in_container(
401401
package=container_package_dir,
402402
wheel=wheel_to_test,
403403
)
404-
test_cwd = testing_temp_dir / "test_cwd"
405-
container.call(["mkdir", "-p", test_cwd])
406-
container.copy_into(test_fail_cwd_file, test_cwd / "test_fail.py")
404+
405+
if build_options.test_sources:
406+
test_cwd = testing_temp_dir / "test_cwd"
407+
container.call(["mkdir", "-p", test_cwd])
408+
copy_test_sources(
409+
build_options.test_sources,
410+
build_options.package_dir,
411+
test_cwd,
412+
copy_into=container.copy_into,
413+
)
414+
else:
415+
# There are no test sources. Run the tests in the project directory.
416+
test_cwd = PurePosixPath(container_project_path)
407417

408418
container.call(["sh", "-c", test_command_prepared], cwd=test_cwd, env=virtualenv_env)
409419

cibuildwheel/macos.py

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
BuildSelector,
3131
call,
3232
combine_constraints,
33+
copy_test_sources,
3334
detect_ci_provider,
3435
download,
3536
find_compatible_wheel,
@@ -43,7 +44,6 @@
4344
read_python_configs,
4445
shell,
4546
split_config_settings,
46-
test_fail_cwd_file,
4747
unwrap,
4848
virtualenv,
4949
)
@@ -138,7 +138,7 @@ def get_python_configurations(
138138
return python_configurations
139139

140140

141-
def install_cpython(tmp: Path, version: str, url: str, free_threading: bool) -> Path:
141+
def install_cpython(_tmp: Path, version: str, url: str, free_threading: bool) -> Path:
142142
ft = "T" if free_threading else ""
143143
installation_path = Path(f"/Library/Frameworks/Python{ft}.framework/Versions/{version}")
144144
with FileLock(CIBW_CACHE_PATH / f"cpython{version}.lock"):
@@ -160,10 +160,10 @@ def install_cpython(tmp: Path, version: str, url: str, free_threading: bool) ->
160160
"""
161161
)
162162
raise errors.FatalError(msg)
163-
pkg_path = tmp / "Python.pkg"
164-
# download the pkg
165-
download(url, pkg_path)
166-
# install
163+
python_filename = url.split("/")[-1]
164+
pkg_path = CIBW_CACHE_PATH / "cpython-installer" / python_filename
165+
if not pkg_path.exists():
166+
download(url, pkg_path)
167167
args = []
168168
if version.startswith("3.13"):
169169
# Python 3.13 is the first version to have a free-threading option
@@ -735,9 +735,17 @@ def build(options: Options, tmp_path: Path) -> None:
735735
wheel=repaired_wheel,
736736
)
737737

738-
test_cwd = identifier_tmp_dir / "test_cwd"
739-
test_cwd.mkdir(exist_ok=True)
740-
(test_cwd / "test_fail.py").write_text(test_fail_cwd_file.read_text())
738+
if build_options.test_sources:
739+
test_cwd = identifier_tmp_dir / "test_cwd"
740+
test_cwd.mkdir(exist_ok=True)
741+
copy_test_sources(
742+
build_options.test_sources,
743+
build_options.package_dir,
744+
test_cwd,
745+
)
746+
else:
747+
# There are no test sources. Run the tests in the project directory.
748+
test_cwd = Path(".").resolve()
741749

742750
shell_with_arch(test_command_prepared, cwd=test_cwd, env=virtualenv_env)
743751

cibuildwheel/options.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import shlex
1111
import textwrap
1212
import tomllib
13-
from collections.abc import Generator, Iterable, Mapping, Sequence, Set
13+
from collections.abc import Callable, Generator, Iterable, Mapping, Sequence, Set
1414
from pathlib import Path
1515
from typing import Any, Literal, assert_never
1616

@@ -90,6 +90,7 @@ class BuildOptions:
9090
dependency_constraints: DependencyConstraints | None
9191
test_command: str | None
9292
before_test: str | None
93+
test_sources: list[str]
9394
test_requires: list[str]
9495
test_extras: str
9596
test_groups: list[str]
@@ -169,11 +170,12 @@ class ListFormat(OptionFormat):
169170
A format that joins lists with a separator.
170171
"""
171172

172-
def __init__(self, sep: str) -> None:
173+
def __init__(self, sep: str, quote: Callable[[str], str] | None = None) -> None:
173174
self.sep = sep
175+
self.quote = quote if quote else lambda s: s
174176

175177
def format_list(self, value: SettingList) -> str:
176-
return self.sep.join(str(v) for v in value)
178+
return self.sep.join(self.quote(str(v)) for v in value)
177179

178180
def merge_values(self, before: str, after: str) -> str:
179181
return f"{before}{self.sep}{after}"
@@ -680,6 +682,11 @@ def build_options(self, identifier: str | None) -> BuildOptions:
680682
dependency_versions = self.reader.get("dependency-versions")
681683
test_command = self.reader.get("test-command", option_format=ListFormat(sep=" && "))
682684
before_test = self.reader.get("before-test", option_format=ListFormat(sep=" && "))
685+
test_sources = shlex.split(
686+
self.reader.get(
687+
"test-sources", option_format=ListFormat(sep=" ", quote=shlex.quote)
688+
)
689+
)
683690
test_requires = self.reader.get(
684691
"test-requires", option_format=ListFormat(sep=" ")
685692
).split()
@@ -788,6 +795,7 @@ def build_options(self, identifier: str | None) -> BuildOptions:
788795
return BuildOptions(
789796
globals=self.globals,
790797
test_command=test_command,
798+
test_sources=test_sources,
791799
test_requires=[*test_requires, *test_requirements_from_groups],
792800
test_extras=test_extras,
793801
test_groups=test_groups,

cibuildwheel/pyodide.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
BuildSelector,
2222
call,
2323
combine_constraints,
24+
copy_test_sources,
2425
download,
2526
ensure_node,
2627
extract_zip,
@@ -31,7 +32,6 @@
3132
read_python_configs,
3233
shell,
3334
split_config_settings,
34-
test_fail_cwd_file,
3535
virtualenv,
3636
)
3737

@@ -387,9 +387,17 @@ def build(options: Options, tmp_path: Path) -> None:
387387
package=build_options.package_dir.resolve(),
388388
)
389389

390-
test_cwd = identifier_tmp_dir / "test_cwd"
391-
test_cwd.mkdir(exist_ok=True)
392-
(test_cwd / "test_fail.py").write_text(test_fail_cwd_file.read_text())
390+
if build_options.test_sources:
391+
test_cwd = identifier_tmp_dir / "test_cwd"
392+
test_cwd.mkdir(exist_ok=True)
393+
copy_test_sources(
394+
build_options.test_sources,
395+
build_options.package_dir,
396+
test_cwd,
397+
)
398+
else:
399+
# There are no test sources. Run the tests in the project directory.
400+
test_cwd = Path(".").resolve()
393401

394402
shell(test_command_prepared, cwd=test_cwd, env=virtualenv_env)
395403

cibuildwheel/resources/build-platforms.toml

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -138,15 +138,15 @@ python_configurations = [
138138
{ identifier = "cp311-macosx_x86_64", version = "3.11", url = "https://www.python.org/ftp/python/3.11.9/python-3.11.9-macos11.pkg" },
139139
{ identifier = "cp311-macosx_arm64", version = "3.11", url = "https://www.python.org/ftp/python/3.11.9/python-3.11.9-macos11.pkg" },
140140
{ identifier = "cp311-macosx_universal2", version = "3.11", url = "https://www.python.org/ftp/python/3.11.9/python-3.11.9-macos11.pkg" },
141-
{ identifier = "cp312-macosx_x86_64", version = "3.12", url = "https://www.python.org/ftp/python/3.12.7/python-3.12.7-macos11.pkg" },
142-
{ identifier = "cp312-macosx_arm64", version = "3.12", url = "https://www.python.org/ftp/python/3.12.7/python-3.12.7-macos11.pkg" },
143-
{ identifier = "cp312-macosx_universal2", version = "3.12", url = "https://www.python.org/ftp/python/3.12.7/python-3.12.7-macos11.pkg" },
144-
{ identifier = "cp313-macosx_x86_64", version = "3.13", url = "https://www.python.org/ftp/python/3.13.0/python-3.13.0-macos11.pkg" },
145-
{ identifier = "cp313-macosx_arm64", version = "3.13", url = "https://www.python.org/ftp/python/3.13.0/python-3.13.0-macos11.pkg" },
146-
{ identifier = "cp313-macosx_universal2", version = "3.13", url = "https://www.python.org/ftp/python/3.13.0/python-3.13.0-macos11.pkg" },
147-
{ identifier = "cp313t-macosx_x86_64", version = "3.13", url = "https://www.python.org/ftp/python/3.13.0/python-3.13.0-macos11.pkg" },
148-
{ identifier = "cp313t-macosx_arm64", version = "3.13", url = "https://www.python.org/ftp/python/3.13.0/python-3.13.0-macos11.pkg" },
149-
{ identifier = "cp313t-macosx_universal2", version = "3.13", url = "https://www.python.org/ftp/python/3.13.0/python-3.13.0-macos11.pkg" },
141+
{ identifier = "cp312-macosx_x86_64", version = "3.12", url = "https://www.python.org/ftp/python/3.12.8/python-3.12.8-macos11.pkg" },
142+
{ identifier = "cp312-macosx_arm64", version = "3.12", url = "https://www.python.org/ftp/python/3.12.8/python-3.12.8-macos11.pkg" },
143+
{ identifier = "cp312-macosx_universal2", version = "3.12", url = "https://www.python.org/ftp/python/3.12.8/python-3.12.8-macos11.pkg" },
144+
{ identifier = "cp313-macosx_x86_64", version = "3.13", url = "https://www.python.org/ftp/python/3.13.1/python-3.13.1-macos11.pkg" },
145+
{ identifier = "cp313-macosx_arm64", version = "3.13", url = "https://www.python.org/ftp/python/3.13.1/python-3.13.1-macos11.pkg" },
146+
{ identifier = "cp313-macosx_universal2", version = "3.13", url = "https://www.python.org/ftp/python/3.13.1/python-3.13.1-macos11.pkg" },
147+
{ identifier = "cp313t-macosx_x86_64", version = "3.13", url = "https://www.python.org/ftp/python/3.13.1/python-3.13.1-macos11.pkg" },
148+
{ identifier = "cp313t-macosx_arm64", version = "3.13", url = "https://www.python.org/ftp/python/3.13.1/python-3.13.1-macos11.pkg" },
149+
{ identifier = "cp313t-macosx_universal2", version = "3.13", url = "https://www.python.org/ftp/python/3.13.1/python-3.13.1-macos11.pkg" },
150150
{ identifier = "pp37-macosx_x86_64", version = "3.7", url = "https://downloads.python.org/pypy/pypy3.7-v7.3.9-osx64.tar.bz2" },
151151
{ identifier = "pp38-macosx_x86_64", version = "3.8", url = "https://downloads.python.org/pypy/pypy3.8-v7.3.11-macos_x86_64.tar.bz2" },
152152
{ identifier = "pp38-macosx_arm64", version = "3.8", url = "https://downloads.python.org/pypy/pypy3.8-v7.3.11-macos_arm64.tar.bz2" },
@@ -170,18 +170,18 @@ python_configurations = [
170170
{ identifier = "cp310-win_amd64", version = "3.10.11", arch = "64" },
171171
{ identifier = "cp311-win32", version = "3.11.9", arch = "32" },
172172
{ identifier = "cp311-win_amd64", version = "3.11.9", arch = "64" },
173-
{ identifier = "cp312-win32", version = "3.12.7", arch = "32" },
174-
{ identifier = "cp312-win_amd64", version = "3.12.7", arch = "64" },
175-
{ identifier = "cp313-win32", version = "3.13.0", arch = "32" },
176-
{ identifier = "cp313t-win32", version = "3.13.0", arch = "32" },
177-
{ identifier = "cp313-win_amd64", version = "3.13.0", arch = "64" },
178-
{ identifier = "cp313t-win_amd64", version = "3.13.0", arch = "64" },
173+
{ identifier = "cp312-win32", version = "3.12.8", arch = "32" },
174+
{ identifier = "cp312-win_amd64", version = "3.12.8", arch = "64" },
175+
{ identifier = "cp313-win32", version = "3.13.1", arch = "32" },
176+
{ identifier = "cp313t-win32", version = "3.13.1", arch = "32" },
177+
{ identifier = "cp313-win_amd64", version = "3.13.1", arch = "64" },
178+
{ identifier = "cp313t-win_amd64", version = "3.13.1", arch = "64" },
179179
{ identifier = "cp39-win_arm64", version = "3.9.10", arch = "ARM64" },
180180
{ identifier = "cp310-win_arm64", version = "3.10.11", arch = "ARM64" },
181181
{ identifier = "cp311-win_arm64", version = "3.11.9", arch = "ARM64" },
182-
{ identifier = "cp312-win_arm64", version = "3.12.7", arch = "ARM64" },
183-
{ identifier = "cp313-win_arm64", version = "3.13.0", arch = "ARM64" },
184-
{ identifier = "cp313t-win_arm64", version = "3.13.0", arch = "ARM64" },
182+
{ identifier = "cp312-win_arm64", version = "3.12.8", arch = "ARM64" },
183+
{ identifier = "cp313-win_arm64", version = "3.13.1", arch = "ARM64" },
184+
{ identifier = "cp313t-win_arm64", version = "3.13.1", arch = "ARM64" },
185185
{ identifier = "pp37-win_amd64", version = "3.7", arch = "64", url = "https://downloads.python.org/pypy/pypy3.7-v7.3.9-win64.zip" },
186186
{ identifier = "pp38-win_amd64", version = "3.8", arch = "64", url = "https://downloads.python.org/pypy/pypy3.8-v7.3.11-win64.zip" },
187187
{ identifier = "pp39-win_amd64", version = "3.9", arch = "64", url = "https://downloads.python.org/pypy/pypy3.9-v7.3.16-win64.zip" },
@@ -190,5 +190,5 @@ python_configurations = [
190190

191191
[pyodide]
192192
python_configurations = [
193-
{ identifier = "cp312-pyodide_wasm32", version = "3.12", pyodide_version = "0.26.4", pyodide_build_version = "0.29.0", emscripten_version = "3.1.58", node_version = "v20" },
193+
{ identifier = "cp312-pyodide_wasm32", version = "3.12", pyodide_version = "0.27.0", pyodide_build_version = "0.29.2", emscripten_version = "3.1.58", node_version = "v20" },
194194
]

0 commit comments

Comments
 (0)