Skip to content

Commit a96545b

Browse files
mayeutjoerick
andauthored
feat: use python3.11+ for cibuildwheel driver (#1912)
* chore: use SPEC 0 schedule for cibuildwheel * remove support for {python} and {pip} in commands * Remove specific Python versions from the update-dependencies job The requirements pinning is done by uv now, so we don't need to run the versions of Python to do the pinning anymore. --------- Co-authored-by: Joe Rickerby <[email protected]>
1 parent 1608f75 commit a96545b

33 files changed

+117
-166
lines changed

.cirrus.yml

+23-12
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ run_tests: &RUN_TESTS
77
run_cibuildwheel_tests_script:
88
- python ./bin/run_tests.py
99

10-
1110
linux_x86_task:
1211
timeout_in: 120m
1312
compute_engine_instance:
@@ -16,10 +15,15 @@ linux_x86_task:
1615
platform: linux
1716
cpu: 8
1817
memory: 8G
19-
18+
env:
19+
VENV_ROOT: ${HOME}/venv-cibuildwheel
20+
PATH: ${VENV_ROOT}/bin:${PATH}
2021
install_pre_requirements_script:
2122
- docker run --rm --privileged docker.io/tonistiigi/binfmt:latest --install all
22-
- apt install -y python3-venv python-is-python3
23+
- add-apt-repository -y ppa:deadsnakes/ppa
24+
- apt-get update
25+
- apt-get install -y python3.12-venv
26+
- python3.12 -m venv ${VENV_ROOT}
2327
<<: *RUN_TESTS
2428

2529
linux_aarch64_task:
@@ -30,10 +34,15 @@ linux_aarch64_task:
3034
platform: linux
3135
cpu: 4
3236
memory: 4G
33-
37+
env:
38+
VENV_ROOT: ${HOME}/venv-cibuildwheel
39+
PATH: ${VENV_ROOT}/bin:${PATH}
3440
install_pre_requirements_script:
3541
- docker run --rm --privileged docker.io/tonistiigi/binfmt:latest --install all
36-
- apt install -y python3-venv python-is-python3
42+
- add-apt-repository -y ppa:deadsnakes/ppa
43+
- apt-get update
44+
- apt-get install -y python3.12-venv
45+
- python3.12 -m venv ${VENV_ROOT}
3746
<<: *RUN_TESTS
3847

3948
windows_x86_task:
@@ -46,30 +55,32 @@ windows_x86_task:
4655
memory: 8G
4756

4857
install_pre_requirements_script:
49-
- choco install -y --no-progress python3 --version 3.10.6
58+
- choco install -y --no-progress python3 --version 3.12.4
5059
- refreshenv
5160
- echo PATH=%PATH% >> "%CIRRUS_ENV%"
5261
<<: *RUN_TESTS
5362

5463
macos_arm64_task:
5564
macos_instance:
5665
image: ghcr.io/cirruslabs/macos-runner:sonoma
57-
5866
env:
59-
PATH: /opt/homebrew/opt/[email protected]/libexec/bin:$PATH
67+
VENV_ROOT: ${HOME}/venv-cibuildwheel
68+
PATH: ${VENV_ROOT}/bin:${PATH}
6069
install_pre_requirements_script:
61-
- brew install [email protected]
70+
- brew install [email protected]
71+
- python3.12 -m venv ${VENV_ROOT}
6272
<<: *RUN_TESTS
6373

6474
macos_arm64_cp38_task:
6575
macos_instance:
6676
image: ghcr.io/cirruslabs/macos-runner:sonoma
67-
6877
env:
69-
PATH: /opt/homebrew/opt/[email protected]/libexec/bin:$PATH
78+
VENV_ROOT: ${HOME}/venv-cibuildwheel
79+
PATH: ${VENV_ROOT}/bin:${PATH}
7080
PYTEST_ADDOPTS: --run-cp38-universal2 -k 'test_cp38_arm64_testing_universal2_installer or test_arch_auto'
7181
install_pre_requirements_script:
72-
- brew install [email protected]
82+
- brew install [email protected]
83+
- python3.12 -m venv ${VENV_ROOT}
7384
- curl -fsSLO https://www.python.org/ftp/python/3.8.10/python-3.8.10-macos11.pkg
7485
- sudo installer -pkg python-3.8.10-macos11.pkg -target /
7586
- rm python-3.8.10-macos11.pkg

.github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
python_version: ['3.13']
4242
include:
4343
- os: ubuntu-latest
44-
python_version: '3.8'
44+
python_version: '3.11'
4545
timeout-minutes: 180
4646
steps:
4747
- uses: actions/checkout@v4

.github/workflows/update-dependencies.yml

-2
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

+4-4
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ repos:
2424
rev: v1.14.1
2525
hooks:
2626
- id: mypy
27-
name: mypy 3.8 on cibuildwheel/
27+
name: mypy 3.11 on cibuildwheel/
2828
exclude: ^cibuildwheel/resources/.*py|bin/generate_schema.py$
29-
args: ["--python-version=3.8"]
29+
args: ["--python-version=3.11"]
3030
additional_dependencies: &mypy-dependencies
3131
- bracex
3232
- dependency-groups>=1.2
@@ -47,9 +47,9 @@ repos:
4747
- uv
4848
- validate-pyproject
4949
- id: mypy
50-
name: mypy 3.12
50+
name: mypy 3.13
5151
exclude: ^cibuildwheel/resources/.*py$
52-
args: ["--python-version=3.12"]
52+
args: ["--python-version=3.13"]
5353
additional_dependencies: *mypy-dependencies
5454

5555
- repo: https://github.com/shellcheck-py/shellcheck-py

.travis.yml

+11-11
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ branches:
88

99
jobs:
1010
include:
11-
- name: Linux | x86_64 + i686 | Python 3.9
12-
python: 3.9
11+
- name: Linux | x86_64 + i686 | Python 3.11
12+
python: 3.11
1313
services: docker
1414
env: PYTHON=python
1515

16-
- name: Linux | arm64 | Python 3.9
17-
python: 3.9
16+
- name: Linux | arm64 | Python 3.11
17+
python: 3.11
1818
services: docker
1919
arch: arm64-graviton2
2020
group: edge
@@ -29,8 +29,8 @@ jobs:
2929
packages:
3030
- docker-ce docker-ce-cli containerd.io
3131

32-
- name: Linux | ppc64le | Python 3.9
33-
python: 3.9
32+
- name: Linux | ppc64le | Python 3.11
33+
python: 3.11
3434
services: docker
3535
arch: ppc64le
3636
allow_failure: True
@@ -40,16 +40,16 @@ jobs:
4040
# c.f. https://travis-ci.community/t/running-out-of-disk-space-quota-when-using-docker-on-ppc64le/11634
4141
- PYTEST_ADDOPTS='-k "not test_manylinuxXXXX_only"'
4242

43-
- name: Windows | x86_64 | Python 3.9
43+
- name: Windows | x86_64 | Python 3.11
4444
os: windows
4545
language: shell
4646
before_install:
47-
- choco upgrade python3 -y --version 3.9.13 --limit-output --params "/InstallDir:C:\\Python39"
47+
- choco upgrade python3 -y --version 3.11.9 --limit-output --params "/InstallDir:C:\\Python311"
4848
env:
49-
- PYTHON=C:\\Python39\\python
49+
- PYTHON=C:\\Python311\\python
5050

51-
- name: Linux | s390x | Python 3.9
52-
python: 3.9
51+
- name: Linux | s390x | Python 3.11
52+
python: 3.11
5353
services: docker
5454
arch: s390x
5555
allow_failure: True

CI.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
This is a summary of the host Python versions and platforms covered by the different CI platforms:
22

3-
| | 3.8 | 3.9 | 3.10 | 3.11 | 3.12 |
4-
|---------|----------------------------------|-----------|-----------|---------|--------------------------------------------------|
5-
| Linux | Azure Pipelines / GitHub Actions | Travis CI | Cirrus CI | | AppVeyor¹ / CircleCI¹ / GitHub Actions / GitLab¹ |
6-
| macOS | Azure Pipelines | | Cirrus CI | GitLab¹ | AppVeyor¹ /CircleCI¹ / GitHub Actions |
7-
| Windows | Azure Pipelines | Travis CI | Cirrus CI | | AppVeyor¹ / GitHub Actions / GitLab¹ |
3+
| | 3.11 | 3.12 | 3.13 |
4+
|---------|----------------------------------------------|---------------------------------------------|----------------|
5+
| Linux | Azure Pipelines / GitHub Actions / Travis CI | AppVeyor¹ / CircleCI¹ / Cirrus CI / GitLab¹ | GitHub Actions |
6+
| macOS | Azure Pipelines / GitLab¹ | AppVeyor¹ / CircleCI¹ / Cirrus CI / GitLab¹ | GitHub Actions |
7+
| Windows | Azure Pipelines / Travis CI | AppVeyor¹ / Cirrus CI / GitLab¹ | GitHub Actions |
88

99
> ¹ Runs a reduced set of tests to reduce CI load
1010
11-
Non-x86 architectures are covered on Travis CI using Python 3.9.
11+
Non-x86 architectures are covered on Travis CI using Python 3.11.

azure-pipelines.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -5,37 +5,37 @@ pr:
55
- .pre-commit-config.yaml
66

77
jobs:
8-
- job: linux_38
8+
- job: linux_311
99
timeoutInMinutes: 120
1010
pool: {vmImage: 'Ubuntu-20.04'}
1111
steps:
1212
- task: UsePythonVersion@0
1313
inputs:
14-
versionSpec: '3.8'
14+
versionSpec: '3.11'
1515
- bash: |
1616
docker run --rm --privileged docker.io/tonistiigi/binfmt:latest --install all
1717
python -m pip install dependency-groups
1818
python -m dependency_groups test | xargs python -m pip install -e.
1919
python ./bin/run_tests.py
2020
21-
- job: macos_38
21+
- job: macos_311
2222
pool: {vmImage: 'macOS-13'}
2323
steps:
2424
- task: UsePythonVersion@0
2525
inputs:
26-
versionSpec: '3.8'
26+
versionSpec: '3.11'
2727
- bash: |
2828
python -m pip install dependency-groups
2929
python -m dependency_groups test | xargs python -m pip install -e.
3030
python ./bin/run_tests.py --num-processes 2
3131
32-
- job: windows_38
32+
- job: windows_311
3333
pool: {vmImage: 'windows-2019'}
3434
timeoutInMinutes: 180
3535
steps:
3636
- task: UsePythonVersion@0
3737
inputs:
38-
versionSpec: '3.8'
38+
versionSpec: '3.11'
3939
- bash: |
4040
python -m pip install dependency-groups
4141
python -m dependency_groups test | xargs python -m pip install -e.

bin/bump_version.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,13 @@
1111
import os
1212
import subprocess
1313
import sys
14+
import tomllib
1415
import urllib.parse
1516
from pathlib import Path
1617

1718
import click
1819
from packaging.version import InvalidVersion, Version
1920

20-
if sys.version_info < (3, 11):
21-
import tomli as tomllib
22-
else:
23-
import tomllib
24-
2521
config = [
2622
# file path, version find/replace format
2723
("pyproject.toml", 'version = "{}"'),

bin/update_nodejs.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import difflib
66
import logging
7+
import tomllib
78
from dataclasses import dataclass
89
from pathlib import Path
910
from typing import Final
@@ -16,8 +17,6 @@
1617
from rich.logging import RichHandler
1718
from rich.syntax import Syntax
1819

19-
from cibuildwheel._compat import tomllib
20-
2120
log = logging.getLogger("cibw")
2221

2322
# Looking up the dir instead of using utils.resources_dir

bin/update_pythons.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
import copy
66
import difflib
77
import logging
8+
import tomllib
89
from collections.abc import Mapping, MutableMapping
910
from pathlib import Path
10-
from typing import Any, Final, Literal, TypedDict, Union
11+
from typing import Any, Final, Literal, TypedDict
1112

1213
import click
1314
import requests
@@ -17,7 +18,6 @@
1718
from rich.logging import RichHandler
1819
from rich.syntax import Syntax
1920

20-
from cibuildwheel._compat import tomllib
2121
from cibuildwheel.extra import dump_python_configurations
2222

2323
log = logging.getLogger("cibw")
@@ -50,7 +50,7 @@ class ConfigMacOS(TypedDict):
5050
url: str
5151

5252

53-
AnyConfig = Union[ConfigWinCP, ConfigWinPP, ConfigMacOS]
53+
AnyConfig = ConfigWinCP | ConfigWinPP | ConfigMacOS
5454

5555

5656
# The following set of "Versions" classes allow the initial call to the APIs to

bin/update_virtualenv.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import difflib
66
import logging
77
import subprocess
8+
import tomllib
89
from dataclasses import dataclass
910
from pathlib import Path
1011
from typing import Final
@@ -15,8 +16,6 @@
1516
from rich.logging import RichHandler
1617
from rich.syntax import Syntax
1718

18-
from cibuildwheel._compat import tomllib
19-
2019
log = logging.getLogger("cibw")
2120

2221
# Looking up the dir instead of using utils.resources_dir

cibuildwheel/__main__.py

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from __future__ import annotations
22

33
import argparse
4+
import contextlib
45
import dataclasses
56
import os
67
import shutil
@@ -12,7 +13,7 @@
1213
from collections.abc import Iterable, Sequence, Set
1314
from pathlib import Path
1415
from tempfile import mkdtemp
15-
from typing import Protocol
16+
from typing import Protocol, assert_never
1617

1718
import cibuildwheel
1819
import cibuildwheel.linux
@@ -21,7 +22,6 @@
2122
import cibuildwheel.util
2223
import cibuildwheel.windows
2324
from cibuildwheel import errors
24-
from cibuildwheel._compat.typing import assert_never
2525
from cibuildwheel.architecture import Architecture, allowed_architectures_check
2626
from cibuildwheel.logger import log
2727
from cibuildwheel.options import CommandLineArguments, Options, compute_options
@@ -31,7 +31,6 @@
3131
BuildSelector,
3232
CIProvider,
3333
Unbuffered,
34-
chdir,
3534
detect_ci_provider,
3635
fix_ansi_codes_for_github_actions,
3736
strtobool,
@@ -200,7 +199,7 @@ def main_inner(global_options: GlobalOptions) -> None:
200199
# This is now the new package dir
201200
args.package_dir = project_dir.resolve()
202201

203-
with chdir(project_dir):
202+
with contextlib.chdir(project_dir):
204203
build_in_directory(args)
205204
finally:
206205
# avoid https://github.com/python/cpython/issues/86962 by performing
@@ -418,10 +417,10 @@ def detect_warnings(*, options: Options, identifiers: Iterable[str]) -> list[str
418417
if any(o and ("{python}" in o or "{pip}" in o) for o in option_values):
419418
# Reminder: in an f-string, double braces means literal single brace
420419
msg = (
421-
f"{option_name}: '{{python}}' and '{{pip}}' are no longer needed, "
422-
"and will be removed in cibuildwheel 3. Simply use 'python' or 'pip' instead."
420+
f"{option_name}: '{{python}}' and '{{pip}}' are no longer supported "
421+
"and have been removed in cibuildwheel 3. Simply use 'python' or 'pip' instead."
423422
)
424-
warnings.append(msg)
423+
raise errors.ConfigurationError(msg)
425424

426425
return warnings
427426

cibuildwheel/_compat/__init__.py

-1
This file was deleted.

cibuildwheel/_compat/tomllib.py

-10
This file was deleted.

0 commit comments

Comments
 (0)