Compare commits

...
17 Commits
Author SHA1 Message Date
Henry Schreiner ba8be0d988 Bump version: v2.18.1 2024-05-20 07:22:33 -04:00
mayeut 90dd47640f doc: add documentation for the CIBW_FREE_THREADED_SUPPORT option 2024-05-20 07:12:10 -04:00
mayeut b61324914b chore: pass a PythonConfiguration to install_cpython 2024-05-20 07:12:10 -04:00
mayeut 3992d5719c feat: add option to opt-in free-threaded builds 2024-05-20 07:12:10 -04:00
mayeut 345467c6cf feat: add support for free-threaded (no-gil) Python 3.13 2024-05-20 07:12:10 -04:00
cibuildwheel-bot[bot]andcibuildwheel-bot[bot] <83877280+cibuildwheel-bot[bot]@users.noreply.github.com> 791e41cfec [Bot] Update dependencies (#1832)
Update dependencies

Co-authored-by: cibuildwheel-bot[bot] <83877280+cibuildwheel-bot[bot]@users.noreply.github.com>
2024-05-20 10:08:57 +02:00
Joe Rickerby 9d5f5e60b8 Make container-engine a build (non-global) option (#1792) 2024-05-20 02:47:10 -04:00
Henry Schreiner 1b354cfa63 chore: move to hatchling (#1297) 2024-05-20 02:45:05 -04:00
Matthieu Darbois d1a4c9c074 chore: un-pin virtualenv update (#1830) 2024-05-20 02:21:42 -04:00
Matthieu Darbois 78bca57cb4 fix(tests): linux tests from macOS/Windows arm64 (#1829)
* fix(tests): linux tests from macOS/Windows arm64

When running on arm64, macOS reports machine as `arm64` and Windows as `ARM64`.
We need to override this to `aarch64` when running linux tests.

* fix(tests): fix tests when running with `--run-cp38-universal2`
2024-05-18 18:34:39 +02:00
Henry Schreiner f8894e67f5 chore: use the new github actions reporter for pylint (#1827)
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2024-05-15 23:15:53 -04:00
pre-commit-ci[bot]andpre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> 666a2c3f1a [pre-commit.ci] pre-commit autoupdate (#1826)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.4.3 → v0.4.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.4.3...v0.4.4)
- [github.com/python-jsonschema/check-jsonschema: 0.28.2 → 0.28.3](https://github.com/python-jsonschema/check-jsonschema/compare/0.28.2...0.28.3)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-05-13 23:41:00 -04:00
cibuildwheel-bot[bot]andcibuildwheel-bot[bot] <83877280+cibuildwheel-bot[bot]@users.noreply.github.com> 15447bd591 [Bot] Update dependencies (#1824)
Update dependencies

Co-authored-by: cibuildwheel-bot[bot] <83877280+cibuildwheel-bot[bot]@users.noreply.github.com>
2024-05-13 23:40:45 -04:00
Henry Schreiner 678ef21647 chore: more modern nox (#1823)
* chore: more modern nox

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* docs: fix running from unsourced venv

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* docs: minor typo fix

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* docs: fix wrong link #1825

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2024-05-13 23:40:34 -04:00
Henry Schreiner e82b1bfc44 docs: fix formatting on changelog (#1822)
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2024-05-12 02:37:46 -04:00
Henry Schreiner ced16da65f ci: minor cleanup for readthedocs
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2024-05-12 01:06:26 -04:00
Henry Schreiner 63daa02352 docs: fix options page (#1821)
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2024-05-12 00:51:20 -04:00
67 changed files with 691 additions and 429 deletions
+3 -1
View File
@@ -4,7 +4,9 @@ set -o xtrace
$PYTHON --version
$PYTHON -m pip --version
$PYTHON -m virtualenv -p "$PYTHON" venv
$PYTHON -m virtualenv --version
$PYTHON -m virtualenv --no-setuptools --no-wheel -p "$PYTHON" venv
venv/bin/python -m pip install -U pip
venv/bin/python -m pip install -e ".[dev]"
venv/bin/python -m pip freeze
venv/bin/python --version
-32
View File
@@ -1,32 +0,0 @@
{
"problemMatcher": [
{
"severity": "warning",
"pattern": [
{
"regexp": "^([^:]+):(\\d+):(\\d+): ([A-DF-Z]\\d+): \\033\\[[\\d;]+m([^\\033]+).*$",
"file": 1,
"line": 2,
"column": 3,
"code": 4,
"message": 5
}
],
"owner": "pylint-warning"
},
{
"severity": "error",
"pattern": [
{
"regexp": "^([^:]+):(\\d+):(\\d+): (E\\d+): \\033\\[[\\d;]+m([^\\033]+).*$",
"file": 1,
"line": 2,
"column": 3,
"code": 4,
"message": 5
}
],
"owner": "pylint-error"
}
]
}
+1 -3
View File
@@ -28,9 +28,7 @@ jobs:
- name: Check manifest
run: pipx run nox -s check_manifest
- name: PyLint checks
run: |
echo "::add-matcher::$GITHUB_WORKSPACE/.github/matchers/pylint.json"
pipx run nox -s pylint
run: pipx run nox -s pylint -- --output-format=github
test:
name: Test cibuildwheel on ${{ matrix.os }} (${{ matrix.python_version }})
+2 -8
View File
@@ -14,18 +14,12 @@ repos:
- id: trailing-whitespace
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.3
rev: v0.4.4
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
- id: ruff-format
- repo: https://github.com/asottile/setup-cfg-fmt
rev: v2.5.0
hooks:
- id: setup-cfg-fmt
args: [--include-version-classifiers, --min-py-version=3.8, --max-py-version=3.12]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.10.0
hooks:
@@ -82,7 +76,7 @@ repos:
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.28.2
rev: 0.28.3
hooks:
- id: check-dependabot
- id: check-github-actions
+2 -2
View File
@@ -11,5 +11,5 @@ build:
- asdf install uv latest
- asdf global uv latest
- uv venv
- uv pip install .[docs]
- .venv/bin/python -m mkdocs build --site-dir $READTHEDOCS_OUTPUT/html
- uv pip install -e.[docs]
- NO_COLOR=1 .venv/bin/mkdocs build --strict --site-dir $READTHEDOCS_OUTPUT/html
-6
View File
@@ -1,6 +0,0 @@
recursive-include cibuildwheel *.cfg
recursive-include cibuildwheel *.in
recursive-include cibuildwheel *.py
recursive-include cibuildwheel *.toml
recursive-include cibuildwheel *.txt
recursive-include cibuildwheel *.typed
+24 -19
View File
@@ -93,7 +93,7 @@ jobs:
- uses: actions/setup-python@v5
- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.18.0
run: python -m pip install cibuildwheel==2.18.1
- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse
@@ -165,19 +165,19 @@ Here are some repos that use cibuildwheel.
| [NCNN][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | ncnn is a high-performance neural network inference framework optimized for the mobile platform |
| [Prophet][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | Tool for producing high quality forecasts for time series data that has multiple seasonality with linear or non-linear growth. |
| [MyPy][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | The compiled version of MyPy using MyPyC. |
| [Kivy][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | Open source UI framework written in Python, running on Windows, Linux, macOS, Android and iOS |
| [duckdb][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | DuckDB is an in-process SQL OLAP Database Management System |
| [Kivy][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | Open source UI framework written in Python, running on Windows, Linux, macOS, Android and iOS |
[scikit-learn]: https://github.com/scikit-learn/scikit-learn
[pytorch-fairseq]: https://github.com/pytorch/fairseq
[pytorch-fairseq]: https://github.com/facebookresearch/fairseq
[NumPy]: https://github.com/numpy/numpy
[Tornado]: https://github.com/tornadoweb/tornado
[Matplotlib]: https://github.com/matplotlib/matplotlib
[NCNN]: https://github.com/Tencent/ncnn
[Prophet]: https://github.com/facebook/prophet
[MyPy]: https://github.com/mypyc/mypy_mypyc-wheels
[Kivy]: https://github.com/kivy/kivy
[duckdb]: https://github.com/duckdb/duckdb
[Kivy]: https://github.com/kivy/kivy
[appveyor icon]: docs/data/readme_icons/appveyor.svg
[github icon]: docs/data/readme_icons/github.svg
@@ -210,14 +210,27 @@ Changelog
<!-- this section was generated by bin/update_readme_changelog.py -- do not edit manually -->
### v2.18.1
- 🌟 Add free-threaded Linux and Windows builds for 3.13. New identifiers `cp313t-*`, new option `CIBW_FREE_THREADED_SUPPORT`/`tool.cibuildwheel.free-threaded-support` required to opt-in. [See the docs](https://cibuildwheel.pypa.io/en/stable/options/#free-threaded-support) for more information. (#1831)
- ✨ The `container-engine` is now a build (non-global) option. (#1792)
- 🛠 The build backend for cibuildwheel is now hatchling. (#1297)
- 🛠 Significant improvements and modernization to our noxfile. (#1823)
- 🛠 Use pylint's new GitHub Actions reporter instead of a custom matcher. (#1823)
- 🛠 Unpin virtualenv updates for Python 3.7+ (#1830)
- 🐛 Fix running linux tests from Windows or macOS ARM. (#1788)
- 📚 Fix our documentation build. (#1821)
### v2.18.0
_12 May 2024_
- ✨ Adds CPython 3.13 support, under the prerelease flag [CIBW_PRERELEASE_PYTHONS](https://cibuildwheel.pypa.io/en/stable/options/#prerelease-pythons). This version of cibuildwheel uses 3.13.0b1. Free-threading mode is not available yet, waiting on official binaries (planned for beta 2) and pip support.
- ✨ Adds CPython 3.13 support, under the prerelease flag [CIBW_PRERELEASE_PYTHONS](https://cibuildwheel.pypa.io/en/stable/options/#prerelease-pythons). This version of cibuildwheel uses 3.13.0b1. Free-threading mode is not available yet (#1657), waiting on official binaries (planned for beta 2) and pip support.
While CPython is in beta, the ABI can change, so your wheels might not be compatible with the final release. For this reason, we don't recommend distributing wheels until RC1, at which point 3.13 will be available in cibuildwheel without the flag. (#1816)
- ✨ Musllinux now defaults to `musllinux_1_2`. You can set the older `manylinux_1_1` via config if needed. (#1817)
_While CPython is in beta, the ABI can change, so your wheels might not be compatible with the final release. For this reason, we don't recommend distributing wheels until RC1, at which point 3.13 will be available in cibuildwheel without the flag._ (#1815)
- ✨ Musllinux now defaults to `musllinux_1_2`. You can set the older `musllinux_1_1` via config if needed. (#1817)
- 🛠 No longer pre-seed setuptools/wheel in virtual environments (#1819)
- 🛠 Respect the constraints file when building with pip, matching build (#1818)
- 🛠 Use uv to compile our pinned dependencies, 10x faster and doesn't require special setup (#1778)
@@ -232,14 +245,14 @@ _12 May 2024_
_11 March 2024_
- 🌟 Adds the ability to inherit configuration in TOML overrides. This makes certain configurations much simpler. If you're overriding an option like `before-build` or `environment`, and you just want to add an extra command or environment variable, you can just append (or prepend) to the previous config. See [the docs](https://cibuildwheel.pypa.io/en/stable/options/#inherit) for more information. (#1730)
- 🌟 Adds official support for native arm64 macOS GitHub runners. To use them, just specify `macos-14` as an `os` of your job in your workflow file. You can also keep `macos-13` in your build matrix to build x86_64. Check out the new [GitHub Actions example config](https://cibuildwheel.pypa.io/en/stable/setup/#github-actions).
- 🌟 Adds official support for native `arm64` macOS GitHub runners. To use them, just specify `macos-14` as an `os` of your job in your workflow file. You can also keep `macos-13` in your build matrix to build `x86_64`. Check out the new [GitHub Actions example config](https://cibuildwheel.pypa.io/en/stable/setup/#github-actions).
- ✨ You no longer need to specify `--platform` to run cibuildwheel locally! Instead it will detect your platform automatically. This was a safety feature, no longer necessary. (#1727)
- 🛠 Removed setuptools and wheel pinned versions. This only affects old-style projects without a `pyproject.toml`, projects with `pyproject.toml` are already getting fresh versions of their `build-system.requires` installed into an isolated environment. (#1725)
- 🛠 Improve how the GitHub Action passes arguments (#1757)
- 🛠 Remove a system-wide install of pipx in the GitHub Action (#1745)
- 🐛 No longer will cibuildwheel override the PIP_CONSTRAINT environment variable when using the `build` frontend. Instead it will be extended. (#1675)
- 🐛 Fix a bug where building and testing both x86_86 and arm64 wheels on the same runner caused the wrong architectures in the test environment (#1750)
- 🐛 Fix a bug that prevented testing a CPython 3.8 wheel targeting macOS 11+ on x86_64 (#1768)
- 🐛 No longer will cibuildwheel override the `PIP_CONSTRAINT` environment variable when using the `build` frontend. Instead it will be extended. (#1675)
- 🐛 Fix a bug where building and testing both `x86_86` and `arm64` wheels on the same runner caused the wrong architectures in the test environment (#1750)
- 🐛 Fix a bug that prevented testing a CPython 3.8 wheel targeting macOS 11+ on `x86_64` (#1768)
- 📚 Moved the docs onto the official PyPA domain - they're now available at https://cibuildwheel.pypa.io . (#1775)
- 📚 Docs and examples improvements (#1762, #1734)
@@ -257,14 +270,6 @@ _28 January 2024_
- 🛠 Update manylinux pins to upgrade from a problematic PyPy version. (#1737)
### v2.16.3
_26 January 2024_
- 🐛 Fix a bug when building from sdist, where relative paths to files in the package didn't work because the working directory was wrong (#1687)
- 🛠 Adds the ability to disable mounting the host filesystem in containers to `/host`, through the `disable_host_mount` suboption on [`CIBW_CONTAINER_ENGINE`](https://cibuildwheel.pypa.io/en/stable/options/#container-engine).
- 📚 A lot of docs improvements! (#1708, #1705, #1686, #1679, #1667, #1665)
<!-- END bin/update_readme_changelog.py -->
---
+9 -7
View File
@@ -1,13 +1,12 @@
#!/usr/bin/env python3
# /// script
# dependencies = ["click", "packaging"]
# dependencies = ["click", "packaging", "tomli; python_version<'3.11'"]
# ///
from __future__ import annotations
import configparser
import glob
import os
import subprocess
@@ -18,8 +17,14 @@ from pathlib import Path
import click
from packaging.version import InvalidVersion, Version
if sys.version_info < (3, 11):
import tomli as tomllib
else:
import tomllib
config = [
# file path, version find/replace format
("pyproject.toml", 'version = "{}"'),
("README.md", "cibuildwheel=={}"),
("cibuildwheel/__init__.py", '__version__ = "{}"'),
("docs/faq.md", "cibuildwheel=={}"),
@@ -27,7 +32,6 @@ config = [
("docs/setup.md", "cibuildwheel=={}"),
("examples/*", "cibuildwheel=={}"),
("examples/*", "cibuildwheel@v{}"),
("setup.cfg", "version = {}"),
]
RED = "\u001b[31m"
@@ -37,10 +41,8 @@ OFF = "\u001b[0m"
@click.command()
def bump_version() -> None:
# Update if moving setup.cfg to pyproject.toml
cfg = configparser.ConfigParser()
cfg.read("setup.cfg")
current_version = cfg["metadata"]["version"]
with open("pyproject.toml", "rb") as f:
current_version = tomllib.load(f)["project"]["version"]
try:
commit_date_str = subprocess.run(
+10 -1
View File
@@ -1,5 +1,9 @@
#!/usr/bin/env python
# /// script
# dependencies = ["pyyaml"]
# ///
import argparse
import copy
import json
@@ -100,6 +104,10 @@ properties:
description: Set environment variables on the host to pass-through to the container
during the build.
type: string_array
free-threaded-support:
type: boolean
default: false
description: The project supports free-threaded builds of Python (PEP703)
manylinux-aarch64-image:
type: string
description: Specify alternative manylinux / musllinux container images
@@ -243,8 +251,8 @@ for key, value in schema["properties"].items():
non_global_options = {k: {"$ref": f"#/properties/{k}"} for k in schema["properties"]}
del non_global_options["build"]
del non_global_options["skip"]
del non_global_options["container-engine"]
del non_global_options["test-skip"]
del non_global_options["free-threaded-support"]
overrides["items"]["properties"]["select"]["oneOf"] = string_array
overrides["items"]["properties"] |= non_global_options.copy()
@@ -254,6 +262,7 @@ del overrides["items"]["properties"]["archs"]
not_linux = non_global_options.copy()
del not_linux["environment-pass"]
del not_linux["container-engine"]
for key in list(not_linux):
if "linux-" in key:
del not_linux[key]
+8
View File
@@ -1,5 +1,13 @@
#!/usr/bin/env python3
# /// script
# dependencies = [
# "click",
# "pyyaml",
# "pygithub",
# ]
# ///
"""
Convert a yaml project list into a nice table.
+21 -8
View File
@@ -58,7 +58,7 @@ AnyConfig = Union[ConfigWinCP, ConfigWinPP, ConfigMacOS]
class WindowsVersions:
def __init__(self, arch_str: ArchStr) -> None:
def __init__(self, arch_str: ArchStr, free_threaded: bool) -> None:
response = requests.get("https://api.nuget.org/v3/index.json")
response.raise_for_status()
api_info = response.json()
@@ -72,7 +72,11 @@ class WindowsVersions:
self.arch_str = arch_str
self.arch = ARCH_DICT[arch_str]
self.free_threaded = free_threaded
package = PACKAGE_DICT[arch_str]
if free_threaded:
package = f"{package}-freethreaded"
response = requests.get(f"{endpoint}{package}/index.json")
response.raise_for_status()
@@ -92,8 +96,9 @@ class WindowsVersions:
if not versions:
return None
flags = "t" if self.free_threaded else ""
version = versions[0]
identifier = f"cp{version.major}{version.minor}-{self.arch}"
identifier = f"cp{version.major}{version.minor}{flags}-{self.arch}"
return ConfigWinCP(
identifier=identifier,
version=self.version_dict[version],
@@ -233,9 +238,12 @@ class CPythonVersions:
class AllVersions:
def __init__(self) -> None:
self.windows_32 = WindowsVersions("32")
self.windows_64 = WindowsVersions("64")
self.windows_arm64 = WindowsVersions("ARM64")
self.windows_32 = WindowsVersions("32", False)
self.windows_t_32 = WindowsVersions("32", True)
self.windows_64 = WindowsVersions("64", False)
self.windows_t_64 = WindowsVersions("64", True)
self.windows_arm64 = WindowsVersions("ARM64", False)
self.windows_t_arm64 = WindowsVersions("ARM64", True)
self.windows_pypy_64 = PyPyVersions("64")
self.macos_cpython = CPythonVersions()
@@ -259,14 +267,19 @@ class AllVersions:
config_update = self.macos_pypy.update_version_macos(spec)
elif "macosx_arm64" in identifier:
config_update = self.macos_pypy_arm64.update_version_macos(spec)
elif "win32" in identifier:
if identifier.startswith("cp"):
config_update = self.windows_32.update_version_windows(spec)
elif "t-win32" in identifier and identifier.startswith("cp"):
config_update = self.windows_t_32.update_version_windows(spec)
elif "win32" in identifier and identifier.startswith("cp"):
config_update = self.windows_32.update_version_windows(spec)
elif "t-win_amd64" in identifier and identifier.startswith("cp"):
config_update = self.windows_t_64.update_version_windows(spec)
elif "win_amd64" in identifier:
if identifier.startswith("cp"):
config_update = self.windows_64.update_version_windows(spec)
elif identifier.startswith("pp"):
config_update = self.windows_pypy_64.update_version_windows(spec)
elif "t-win_arm64" in identifier and identifier.startswith("cp"):
config_update = self.windows_t_arm64.update_version_windows(spec)
elif "win_arm64" in identifier and identifier.startswith("cp"):
config_update = self.windows_arm64.update_version_windows(spec)
+10 -9
View File
@@ -53,10 +53,6 @@ def git_ls_remote_versions(url) -> list[VersionTuple]:
if version.is_prerelease:
log.info("Ignoring pre-release %r", str(version))
continue
# Do not upgrade past 20.22.0 to keep python 3.6 compat
if version >= Version("20.22.0"):
log.info("Ignoring %r which is not compatible with python 3.6", str(version))
continue
versions.append(VersionTuple(version, version_string))
except InvalidVersion:
log.warning("Ignoring ref %r", ref)
@@ -82,15 +78,20 @@ def update_virtualenv(force: bool, level: str) -> None:
original_toml = toml_file_path.read_text()
with toml_file_path.open("rb") as f:
loaded_file = tomllib.load(f)
version = str(loaded_file["version"])
configurations = tomllib.load(f)
default = configurations.pop("default")
version = str(default["version"])
versions = git_ls_remote_versions(GET_VIRTUALENV_GITHUB)
if versions[0].version > Version(version):
version = versions[0].version_string
result_toml = (
f'version = "{version}"\n'
f'url = "{GET_VIRTUALENV_URL_TEMPLATE.format(version=version)}"\n'
configurations["default"] = {
"version": version,
"url": GET_VIRTUALENV_URL_TEMPLATE.format(version=version),
}
result_toml = "".join(
f'{key} = {{ version = "{value["version"]}", url = "{value["url"]}" }}\n'
for key, value in configurations.items()
)
rich.print() # spacer
+1 -1
View File
@@ -1,3 +1,3 @@
from __future__ import annotations
__version__ = "2.18.0"
__version__ = "2.18.1"
+42 -32
View File
@@ -11,8 +11,8 @@ from typing import OrderedDict, Tuple
from ._compat.typing import assert_never
from .architecture import Architecture
from .logger import log
from .oci_container import OCIContainer
from .options import Options
from .oci_container import OCIContainer, OCIContainerEngineConfig
from .options import BuildOptions, Options
from .typing import PathOrStr
from .util import (
AlreadyBuiltWheelError,
@@ -44,6 +44,7 @@ class PythonConfiguration:
class BuildStep:
platform_configs: list[PythonConfiguration]
platform_tag: str
container_engine: OCIContainerEngineConfig
container_image: str
@@ -65,8 +66,9 @@ def get_python_configurations(
]
def container_image_for_python_configuration(config: PythonConfiguration, options: Options) -> str:
build_options = options.build_options(config.identifier)
def container_image_for_python_configuration(
config: PythonConfiguration, build_options: BuildOptions
) -> str:
# e.g
# identifier is 'cp310-manylinux_x86_64'
# platform_tag is 'manylinux_x86_64'
@@ -91,15 +93,18 @@ def get_build_steps(
Groups PythonConfigurations into BuildSteps. Each BuildStep represents a
separate container instance.
"""
steps = OrderedDict[Tuple[str, str, str], BuildStep]()
steps = OrderedDict[Tuple[str, str, str, OCIContainerEngineConfig], BuildStep]()
for config in python_configurations:
_, platform_tag = config.identifier.split("-", 1)
before_all = options.build_options(config.identifier).before_all
container_image = container_image_for_python_configuration(config, options)
build_options = options.build_options(config.identifier)
step_key = (platform_tag, container_image, before_all)
before_all = build_options.before_all
container_image = container_image_for_python_configuration(config, build_options)
container_engine = build_options.container_engine
step_key = (platform_tag, container_image, before_all, container_engine)
if step_key in steps:
steps[step_key].platform_configs.append(config)
@@ -107,6 +112,7 @@ def get_build_steps(
steps[step_key] = BuildStep(
platform_configs=[config],
platform_tag=platform_tag,
container_engine=container_engine,
container_image=container_image,
)
@@ -331,6 +337,10 @@ def build_in_container(
virtualenv_env = env.copy()
virtualenv_env["PATH"] = f"{venv_dir / 'bin'}:{virtualenv_env['PATH']}"
# TODO remove me once virtualenv provides pip>=24.1b1
if config.version == "3.13":
container.call(["pip", "install", "pip>=24.1b1"], env=virtualenv_env)
if build_options.before_test:
before_test_prepared = prepare_command(
build_options.before_test,
@@ -388,29 +398,6 @@ def build_in_container(
def build(options: Options, tmp_path: Path) -> None: # noqa: ARG001
try:
# check the container engine is installed
subprocess.run(
[options.globals.container_engine.name, "--version"],
check=True,
stdout=subprocess.DEVNULL,
)
except subprocess.CalledProcessError:
print(
unwrap(
f"""
cibuildwheel: {options.globals.container_engine} not found. An
OCI exe like Docker or Podman is required to run Linux builds.
If you're building on Travis CI, add `services: [docker]` to
your .travis.yml. If you're building on Circle CI in Linux,
add a `setup_remote_docker` step to your .circleci/config.yml.
If you're building on Cirrus CI, use `docker_builder` task.
"""
),
file=sys.stderr,
)
sys.exit(2)
python_configurations = get_python_configurations(
options.globals.build_selector, options.globals.architectures
)
@@ -425,6 +412,29 @@ def build(options: Options, tmp_path: Path) -> None: # noqa: ARG001
container_package_dir = container_project_path / abs_package_dir.relative_to(cwd)
for build_step in get_build_steps(options, python_configurations):
try:
# check the container engine is installed
subprocess.run(
[build_step.container_engine.name, "--version"],
check=True,
stdout=subprocess.DEVNULL,
)
except subprocess.CalledProcessError:
print(
unwrap(
f"""
cibuildwheel: {build_step.container_engine.name} not found. An
OCI exe like Docker or Podman is required to run Linux builds.
If you're building on Travis CI, add `services: [docker]` to
your .travis.yml. If you're building on Circle CI in Linux,
add a `setup_remote_docker` step to your .circleci/config.yml.
If you're building on Cirrus CI, use `docker_builder` task.
"""
),
file=sys.stderr,
)
sys.exit(2)
try:
ids_to_build = [x.identifier for x in build_step.platform_configs]
log.step(f"Starting container image {build_step.container_image}...")
@@ -435,7 +445,7 @@ def build(options: Options, tmp_path: Path) -> None: # noqa: ARG001
image=build_step.container_image,
enforce_32_bit=build_step.platform_tag.endswith("i686"),
cwd=container_project_path,
engine=options.globals.container_engine,
engine=build_step.container_engine,
) as container:
build_in_container(
options=options,
+7 -1
View File
@@ -181,7 +181,9 @@ def setup_python(
log.step("Setting up build environment...")
venv_path = tmp / "venv"
env = virtualenv(base_python, venv_path, dependency_constraint_flags)
env = virtualenv(
python_configuration.version, base_python, venv_path, dependency_constraint_flags
)
venv_bin_path = venv_path / "bin"
assert venv_bin_path.exists()
# Fix issue with site.py setting the wrong `sys.prefix`, `sys.exec_prefix`,
@@ -573,6 +575,10 @@ def build(options: Options, tmp_path: Path) -> None:
# check that we are using the Python from the virtual environment
call_with_arch("which", "python", env=virtualenv_env)
# TODO remove me once virtualenv provides pip>=24.1b1
if config.version == "3.13":
call("python", "-m", "pip", "install", "pip>=24.1b1", env=virtualenv_env)
if build_options.before_test:
before_test_prepared = prepare_command(
build_options.before_test,
+3 -3
View File
@@ -11,7 +11,7 @@ import sys
import typing
import uuid
from collections.abc import Mapping, Sequence
from dataclasses import dataclass
from dataclasses import dataclass, field
from pathlib import Path, PurePath, PurePosixPath
from types import TracebackType
from typing import IO, Dict, Literal
@@ -32,7 +32,7 @@ ContainerEngineName = Literal["docker", "podman"]
@dataclass(frozen=True)
class OCIContainerEngineConfig:
name: ContainerEngineName
create_args: Sequence[str] = ()
create_args: tuple[str, ...] = field(default_factory=tuple)
disable_host_mount: bool = False
@staticmethod
@@ -58,7 +58,7 @@ class OCIContainerEngineConfig:
)
return OCIContainerEngineConfig(
name=name, create_args=create_args, disable_host_mount=disable_host_mount
name=name, create_args=tuple(create_args), disable_host_mount=disable_host_mount
)
def options_summary(self) -> str | dict[str, str]:
+25 -17
View File
@@ -75,7 +75,6 @@ class GlobalOptions:
build_selector: BuildSelector
test_selector: TestSelector
architectures: set[Architecture]
container_engine: OCIContainerEngineConfig
@dataclasses.dataclass(frozen=True)
@@ -95,6 +94,7 @@ class BuildOptions:
build_verbosity: int
build_frontend: BuildFrontendConfig | None
config_settings: str
container_engine: OCIContainerEngineConfig
@property
def package_dir(self) -> Path:
@@ -117,7 +117,7 @@ class BuildOptions:
return self.globals.architectures
Setting = Union[Mapping[str, str], Sequence[str], str, int]
Setting = Union[Mapping[str, str], Sequence[str], str, int, bool]
@dataclasses.dataclass(frozen=True)
@@ -196,7 +196,7 @@ def _resolve_cascade(
if value is None:
continue
if ignore_empty and not value:
if ignore_empty and not value and value is not False:
continue
value_string = _stringify_setting(value, list_sep, table_format)
@@ -258,7 +258,7 @@ def _stringify_setting(
raise ConfigOptionError(msg)
return list_sep.join(setting)
if isinstance(setting, int):
if isinstance(setting, (bool, int)):
return str(setting)
return setting
@@ -516,6 +516,10 @@ class Options:
skip_config = self.reader.get("skip", env_plat=False, list_sep=" ")
test_skip = self.reader.get("test-skip", env_plat=False, list_sep=" ")
free_threaded_support = strtobool(
self.reader.get("free-threaded-support", env_plat=False, ignore_empty=True)
)
prerelease_pythons = args.prerelease_pythons or strtobool(
self.env.get("CIBW_PRERELEASE_PYTHONS", "0")
)
@@ -536,34 +540,23 @@ class Options:
skip_config = ""
architectures = Architecture.all_archs(self.platform)
prerelease_pythons = True
free_threaded_support = True
build_selector = BuildSelector(
build_config=build_config,
skip_config=skip_config,
requires_python=requires_python,
prerelease_pythons=prerelease_pythons,
free_threaded_support=free_threaded_support,
)
test_selector = TestSelector(skip_config=test_skip)
container_engine_str = self.reader.get(
"container-engine",
table_format={"item": "{k}:{v}", "sep": "; ", "quote": shlex.quote},
)
try:
container_engine = OCIContainerEngineConfig.from_config_string(container_engine_str)
except ValueError as e:
msg = f"cibuildwheel: Failed to parse container config. {e}"
print(msg, file=sys.stderr)
sys.exit(2)
return GlobalOptions(
package_dir=package_dir,
output_dir=output_dir,
build_selector=build_selector,
test_selector=test_selector,
architectures=architectures,
container_engine=container_engine,
)
def build_options(self, identifier: str | None) -> BuildOptions:
@@ -643,6 +636,8 @@ class Options:
manylinux_images: dict[str, str] = {}
musllinux_images: dict[str, str] = {}
container_engine: OCIContainerEngineConfig | None = None
if self.platform == "linux":
all_pinned_container_images = _get_pinned_container_images()
@@ -677,6 +672,18 @@ class Options:
musllinux_images[build_platform] = image
container_engine_str = self.reader.get(
"container-engine",
table_format={"item": "{k}:{v}", "sep": "; ", "quote": shlex.quote},
)
try:
container_engine = OCIContainerEngineConfig.from_config_string(container_engine_str)
except ValueError as e:
msg = f"cibuildwheel: Failed to parse container config. {e}"
print(msg, file=sys.stderr)
sys.exit(2)
return BuildOptions(
globals=self.globals,
test_command=test_command,
@@ -693,6 +700,7 @@ class Options:
musllinux_images=musllinux_images or None,
build_frontend=build_frontend,
config_settings=config_settings,
container_engine=container_engine,
)
def check_for_invalid_configuration(self, identifiers: Iterable[str]) -> None:
@@ -8,6 +8,7 @@ python_configurations = [
{ identifier = "cp311-manylinux_x86_64", version = "3.11", path_str = "/opt/python/cp311-cp311" },
{ identifier = "cp312-manylinux_x86_64", version = "3.12", path_str = "/opt/python/cp312-cp312" },
{ identifier = "cp313-manylinux_x86_64", version = "3.13", path_str = "/opt/python/cp313-cp313" },
{ identifier = "cp313t-manylinux_x86_64", version = "3.13", path_str = "/opt/python/cp313-cp313t" },
{ identifier = "cp36-manylinux_i686", version = "3.6", path_str = "/opt/python/cp36-cp36m" },
{ identifier = "cp37-manylinux_i686", version = "3.7", path_str = "/opt/python/cp37-cp37m" },
{ identifier = "cp38-manylinux_i686", version = "3.8", path_str = "/opt/python/cp38-cp38" },
@@ -16,6 +17,7 @@ python_configurations = [
{ identifier = "cp311-manylinux_i686", version = "3.11", path_str = "/opt/python/cp311-cp311" },
{ identifier = "cp312-manylinux_i686", version = "3.12", path_str = "/opt/python/cp312-cp312" },
{ identifier = "cp313-manylinux_i686", version = "3.13", path_str = "/opt/python/cp313-cp313" },
{ identifier = "cp313t-manylinux_i686", version = "3.13", path_str = "/opt/python/cp313-cp313t" },
{ identifier = "pp37-manylinux_x86_64", version = "3.7", path_str = "/opt/python/pp37-pypy37_pp73" },
{ identifier = "pp38-manylinux_x86_64", version = "3.8", path_str = "/opt/python/pp38-pypy38_pp73" },
{ identifier = "pp39-manylinux_x86_64", version = "3.9", path_str = "/opt/python/pp39-pypy39_pp73" },
@@ -28,6 +30,7 @@ python_configurations = [
{ identifier = "cp311-manylinux_aarch64", version = "3.11", path_str = "/opt/python/cp311-cp311" },
{ identifier = "cp312-manylinux_aarch64", version = "3.12", path_str = "/opt/python/cp312-cp312" },
{ identifier = "cp313-manylinux_aarch64", version = "3.13", path_str = "/opt/python/cp313-cp313" },
{ identifier = "cp313t-manylinux_aarch64", version = "3.13", path_str = "/opt/python/cp313-cp313t" },
{ identifier = "cp36-manylinux_ppc64le", version = "3.6", path_str = "/opt/python/cp36-cp36m" },
{ identifier = "cp37-manylinux_ppc64le", version = "3.7", path_str = "/opt/python/cp37-cp37m" },
{ identifier = "cp38-manylinux_ppc64le", version = "3.8", path_str = "/opt/python/cp38-cp38" },
@@ -36,6 +39,7 @@ python_configurations = [
{ identifier = "cp311-manylinux_ppc64le", version = "3.11", path_str = "/opt/python/cp311-cp311" },
{ identifier = "cp312-manylinux_ppc64le", version = "3.12", path_str = "/opt/python/cp312-cp312" },
{ identifier = "cp313-manylinux_ppc64le", version = "3.13", path_str = "/opt/python/cp313-cp313" },
{ identifier = "cp313t-manylinux_ppc64le", version = "3.13", path_str = "/opt/python/cp313-cp313t" },
{ identifier = "cp36-manylinux_s390x", version = "3.6", path_str = "/opt/python/cp36-cp36m" },
{ identifier = "cp37-manylinux_s390x", version = "3.7", path_str = "/opt/python/cp37-cp37m" },
{ identifier = "cp38-manylinux_s390x", version = "3.8", path_str = "/opt/python/cp38-cp38" },
@@ -44,6 +48,7 @@ python_configurations = [
{ identifier = "cp311-manylinux_s390x", version = "3.11", path_str = "/opt/python/cp311-cp311" },
{ identifier = "cp312-manylinux_s390x", version = "3.12", path_str = "/opt/python/cp312-cp312" },
{ identifier = "cp313-manylinux_s390x", version = "3.13", path_str = "/opt/python/cp313-cp313" },
{ identifier = "cp313t-manylinux_s390x", version = "3.13", path_str = "/opt/python/cp313-cp313t" },
{ identifier = "pp37-manylinux_aarch64", version = "3.7", path_str = "/opt/python/pp37-pypy37_pp73" },
{ identifier = "pp38-manylinux_aarch64", version = "3.8", path_str = "/opt/python/pp38-pypy38_pp73" },
{ identifier = "pp39-manylinux_aarch64", version = "3.9", path_str = "/opt/python/pp39-pypy39_pp73" },
@@ -60,6 +65,7 @@ python_configurations = [
{ identifier = "cp311-musllinux_x86_64", version = "3.11", path_str = "/opt/python/cp311-cp311" },
{ identifier = "cp312-musllinux_x86_64", version = "3.12", path_str = "/opt/python/cp312-cp312" },
{ identifier = "cp313-musllinux_x86_64", version = "3.13", path_str = "/opt/python/cp313-cp313" },
{ identifier = "cp313t-musllinux_x86_64", version = "3.13", path_str = "/opt/python/cp313-cp313t" },
{ identifier = "cp36-musllinux_i686", version = "3.6", path_str = "/opt/python/cp36-cp36m" },
{ identifier = "cp37-musllinux_i686", version = "3.7", path_str = "/opt/python/cp37-cp37m" },
{ identifier = "cp38-musllinux_i686", version = "3.8", path_str = "/opt/python/cp38-cp38" },
@@ -68,6 +74,7 @@ python_configurations = [
{ identifier = "cp311-musllinux_i686", version = "3.11", path_str = "/opt/python/cp311-cp311" },
{ identifier = "cp312-musllinux_i686", version = "3.12", path_str = "/opt/python/cp312-cp312" },
{ identifier = "cp313-musllinux_i686", version = "3.13", path_str = "/opt/python/cp313-cp313" },
{ identifier = "cp313t-musllinux_i686", version = "3.13", path_str = "/opt/python/cp313-cp313t" },
{ identifier = "cp36-musllinux_aarch64", version = "3.6", path_str = "/opt/python/cp36-cp36m" },
{ identifier = "cp37-musllinux_aarch64", version = "3.7", path_str = "/opt/python/cp37-cp37m" },
{ identifier = "cp38-musllinux_aarch64", version = "3.8", path_str = "/opt/python/cp38-cp38" },
@@ -76,6 +83,7 @@ python_configurations = [
{ identifier = "cp311-musllinux_aarch64", version = "3.11", path_str = "/opt/python/cp311-cp311" },
{ identifier = "cp312-musllinux_aarch64", version = "3.12", path_str = "/opt/python/cp312-cp312" },
{ identifier = "cp313-musllinux_aarch64", version = "3.13", path_str = "/opt/python/cp313-cp313" },
{ identifier = "cp313t-musllinux_aarch64", version = "3.13", path_str = "/opt/python/cp313-cp313t" },
{ identifier = "cp36-musllinux_ppc64le", version = "3.6", path_str = "/opt/python/cp36-cp36m" },
{ identifier = "cp37-musllinux_ppc64le", version = "3.7", path_str = "/opt/python/cp37-cp37m" },
{ identifier = "cp38-musllinux_ppc64le", version = "3.8", path_str = "/opt/python/cp38-cp38" },
@@ -84,6 +92,7 @@ python_configurations = [
{ identifier = "cp311-musllinux_ppc64le", version = "3.11", path_str = "/opt/python/cp311-cp311" },
{ identifier = "cp312-musllinux_ppc64le", version = "3.12", path_str = "/opt/python/cp312-cp312" },
{ identifier = "cp313-musllinux_ppc64le", version = "3.13", path_str = "/opt/python/cp313-cp313" },
{ identifier = "cp313t-musllinux_ppc64le", version = "3.13", path_str = "/opt/python/cp313-cp313t" },
{ identifier = "cp36-musllinux_s390x", version = "3.6", path_str = "/opt/python/cp36-cp36m" },
{ identifier = "cp37-musllinux_s390x", version = "3.7", path_str = "/opt/python/cp37-cp37m" },
{ identifier = "cp38-musllinux_s390x", version = "3.8", path_str = "/opt/python/cp38-cp38" },
@@ -92,6 +101,7 @@ python_configurations = [
{ identifier = "cp311-musllinux_s390x", version = "3.11", path_str = "/opt/python/cp311-cp311" },
{ identifier = "cp312-musllinux_s390x", version = "3.12", path_str = "/opt/python/cp312-cp312" },
{ identifier = "cp313-musllinux_s390x", version = "3.13", path_str = "/opt/python/cp313-cp313" },
{ identifier = "cp313t-musllinux_s390x", version = "3.13", path_str = "/opt/python/cp313-cp313t" },
]
[macos]
@@ -142,12 +152,15 @@ python_configurations = [
{ identifier = "cp312-win32", version = "3.12.3", arch = "32" },
{ identifier = "cp312-win_amd64", version = "3.12.3", arch = "64" },
{ identifier = "cp313-win32", version = "3.13.0-b1", arch = "32" },
{ identifier = "cp313t-win32", version = "3.13.0-b1", arch = "32" },
{ identifier = "cp313-win_amd64", version = "3.13.0-b1", arch = "64" },
{ identifier = "cp313t-win_amd64", version = "3.13.0-b1", arch = "64" },
{ identifier = "cp39-win_arm64", version = "3.9.10", arch = "ARM64" },
{ identifier = "cp310-win_arm64", version = "3.10.11", arch = "ARM64" },
{ identifier = "cp311-win_arm64", version = "3.11.9", arch = "ARM64" },
{ identifier = "cp312-win_arm64", version = "3.12.3", arch = "ARM64" },
{ identifier = "cp313-win_arm64", version = "3.13.0-b1", arch = "ARM64" },
{ identifier = "cp313t-win_arm64", version = "3.13.0-b1", arch = "ARM64" },
{ identifier = "pp37-win_amd64", version = "3.7", arch = "64", url = "https://downloads.python.org/pypy/pypy3.7-v7.3.9-win64.zip" },
{ identifier = "pp38-win_amd64", version = "3.8", arch = "64", url = "https://downloads.python.org/pypy/pypy3.8-v7.3.11-win64.zip" },
{ identifier = "pp39-win_amd64", version = "3.9", arch = "64", url = "https://downloads.python.org/pypy/pypy3.9-v7.3.16-win64.zip" },
@@ -255,6 +255,12 @@
],
"title": "CIBW_ENVIRONMENT_PASS"
},
"free-threaded-support": {
"type": "boolean",
"default": false,
"description": "The project supports free-threaded builds of Python (PEP703)",
"title": "CIBW_FREE_THREADED_SUPPORT"
},
"manylinux-aarch64-image": {
"type": "string",
"description": "Specify alternative manylinux / musllinux container images",
@@ -491,6 +497,9 @@
"config-settings": {
"$ref": "#/properties/config-settings"
},
"container-engine": {
"$ref": "#/properties/container-engine"
},
"dependency-versions": {
"$ref": "#/properties/dependency-versions"
},
@@ -579,6 +588,9 @@
"config-settings": {
"$ref": "#/properties/config-settings"
},
"container-engine": {
"$ref": "#/properties/container-engine"
},
"environment": {
"$ref": "#/properties/environment"
},
@@ -3,7 +3,9 @@
altgraph==0.17.4
# via macholib
build==1.2.1
# via -r cibuildwheel/resources/constraints.in
delocate==0.11.0
# via -r cibuildwheel/resources/constraints.in
distlib==0.3.8
# via virtualenv
filelock==3.14.0
@@ -17,7 +19,8 @@ packaging==24.0
# build
# delocate
pip==24.0
platformdirs==4.2.1
# via -r cibuildwheel/resources/constraints.in
platformdirs==4.2.2
# via virtualenv
pyproject-hooks==1.1.0
# via build
@@ -25,6 +28,7 @@ tomli==2.0.1
# via build
typing-extensions==4.11.0
# via delocate
virtualenv==20.26.1
zipp==3.18.1
virtualenv==20.26.2
# via -r cibuildwheel/resources/constraints.in
zipp==3.18.2
# via importlib-metadata
@@ -3,7 +3,9 @@
altgraph==0.17.4
# via macholib
build==1.2.1
# via -r cibuildwheel/resources/constraints.in
delocate==0.11.0
# via -r cibuildwheel/resources/constraints.in
distlib==0.3.8
# via virtualenv
filelock==3.14.0
@@ -15,10 +17,12 @@ packaging==24.0
# build
# delocate
pip==24.0
platformdirs==4.2.1
# via -r cibuildwheel/resources/constraints.in
platformdirs==4.2.2
# via virtualenv
pyproject-hooks==1.1.0
# via build
typing-extensions==4.11.0
# via delocate
virtualenv==20.26.1
virtualenv==20.26.2
# via -r cibuildwheel/resources/constraints.in
@@ -3,7 +3,9 @@
altgraph==0.17.4
# via macholib
build==1.2.1
# via -r cibuildwheel/resources/constraints.in
delocate==0.11.0
# via -r cibuildwheel/resources/constraints.in
distlib==0.3.8
# via virtualenv
filelock==3.14.0
@@ -15,10 +17,12 @@ packaging==24.0
# build
# delocate
pip==24.0
platformdirs==4.2.1
# via -r cibuildwheel/resources/constraints.in
platformdirs==4.2.2
# via virtualenv
pyproject-hooks==1.1.0
# via build
typing-extensions==4.11.0
# via delocate
virtualenv==20.26.1
virtualenv==20.26.2
# via -r cibuildwheel/resources/constraints.in
@@ -3,7 +3,9 @@
altgraph==0.17.4
# via macholib
build==1.2.1
# via -r cibuildwheel/resources/constraints.in
delocate==0.11.0
# via -r cibuildwheel/resources/constraints.in
distlib==0.3.8
# via virtualenv
filelock==3.14.0
@@ -14,11 +16,13 @@ packaging==24.0
# via
# build
# delocate
pip==24.0
platformdirs==4.2.1
pip==24.1b1
# via -r cibuildwheel/resources/constraints.in
platformdirs==4.2.2
# via virtualenv
pyproject-hooks==1.1.0
# via build
typing-extensions==4.11.0
# via delocate
virtualenv==20.26.1
virtualenv==20.26.2
# via -r cibuildwheel/resources/constraints.in
@@ -3,7 +3,9 @@
altgraph==0.17.4
# via macholib
build==1.1.1
# via -r cibuildwheel/resources/constraints.in
delocate==0.11.0
# via -r cibuildwheel/resources/constraints.in
distlib==0.3.8
# via virtualenv
filelock==3.12.2
@@ -19,6 +21,7 @@ packaging==24.0
# build
# delocate
pip==24.0
# via -r cibuildwheel/resources/constraints.in
platformdirs==4.0.0
# via virtualenv
pyproject-hooks==1.1.0
@@ -30,6 +33,7 @@ typing-extensions==4.7.1
# delocate
# importlib-metadata
# platformdirs
virtualenv==20.26.1
virtualenv==20.26.2
# via -r cibuildwheel/resources/constraints.in
zipp==3.15.0
# via importlib-metadata
@@ -3,7 +3,9 @@
altgraph==0.17.4
# via macholib
build==1.2.1
# via -r cibuildwheel/resources/constraints.in
delocate==0.11.0
# via -r cibuildwheel/resources/constraints.in
distlib==0.3.8
# via virtualenv
filelock==3.14.0
@@ -17,7 +19,8 @@ packaging==24.0
# build
# delocate
pip==24.0
platformdirs==4.2.1
# via -r cibuildwheel/resources/constraints.in
platformdirs==4.2.2
# via virtualenv
pyproject-hooks==1.1.0
# via build
@@ -25,6 +28,7 @@ tomli==2.0.1
# via build
typing-extensions==4.11.0
# via delocate
virtualenv==20.26.1
zipp==3.18.1
virtualenv==20.26.2
# via -r cibuildwheel/resources/constraints.in
zipp==3.18.2
# via importlib-metadata
@@ -3,7 +3,9 @@
altgraph==0.17.4
# via macholib
build==1.2.1
# via -r cibuildwheel/resources/constraints.in
delocate==0.11.0
# via -r cibuildwheel/resources/constraints.in
distlib==0.3.8
# via virtualenv
filelock==3.14.0
@@ -17,7 +19,8 @@ packaging==24.0
# build
# delocate
pip==24.0
platformdirs==4.2.1
# via -r cibuildwheel/resources/constraints.in
platformdirs==4.2.2
# via virtualenv
pyproject-hooks==1.1.0
# via build
@@ -25,6 +28,7 @@ tomli==2.0.1
# via build
typing-extensions==4.11.0
# via delocate
virtualenv==20.26.1
zipp==3.18.1
virtualenv==20.26.2
# via -r cibuildwheel/resources/constraints.in
zipp==3.18.2
# via importlib-metadata
+2 -1
View File
@@ -1,4 +1,5 @@
pip
pip>=24.1b1 ; python_version >= '3.13'
pip ; python_version < '3.13'
build
delocate
virtualenv
+6 -2
View File
@@ -3,7 +3,9 @@
altgraph==0.17.4
# via macholib
build==1.2.1
# via -r cibuildwheel/resources/constraints.in
delocate==0.11.0
# via -r cibuildwheel/resources/constraints.in
distlib==0.3.8
# via virtualenv
filelock==3.14.0
@@ -15,10 +17,12 @@ packaging==24.0
# build
# delocate
pip==24.0
platformdirs==4.2.1
# via -r cibuildwheel/resources/constraints.in
platformdirs==4.2.2
# via virtualenv
pyproject-hooks==1.1.0
# via build
typing-extensions==4.11.0
# via delocate
virtualenv==20.26.1
virtualenv==20.26.2
# via -r cibuildwheel/resources/constraints.in
+1
View File
@@ -2,6 +2,7 @@
build = "*"
skip = ""
test-skip = ""
free-threaded-support = false
archs = ["auto"]
build-frontend = "default"
+24 -24
View File
@@ -1,54 +1,54 @@
[x86_64]
manylinux1 = quay.io/pypa/manylinux1_x86_64:2024-04-29-76807b8
manylinux2010 = quay.io/pypa/manylinux2010_x86_64:2022-08-05-4535177
manylinux2014 = quay.io/pypa/manylinux2014_x86_64:2024-05-10-7415d48
manylinux2014 = quay.io/pypa/manylinux2014_x86_64:2024-05-13-0983f6f
manylinux_2_24 = quay.io/pypa/manylinux_2_24_x86_64:2022-12-26-0d38463
manylinux_2_28 = quay.io/pypa/manylinux_2_28_x86_64:2024-05-10-7415d48
musllinux_1_1 = quay.io/pypa/musllinux_1_1_x86_64:2024-05-10-7415d48
musllinux_1_2 = quay.io/pypa/musllinux_1_2_x86_64:2024-05-10-7415d48
manylinux_2_28 = quay.io/pypa/manylinux_2_28_x86_64:2024-05-13-0983f6f
musllinux_1_1 = quay.io/pypa/musllinux_1_1_x86_64:2024-05-13-0983f6f
musllinux_1_2 = quay.io/pypa/musllinux_1_2_x86_64:2024-05-13-0983f6f
[i686]
manylinux1 = quay.io/pypa/manylinux1_i686:2024-04-29-76807b8
manylinux2010 = quay.io/pypa/manylinux2010_i686:2022-08-05-4535177
manylinux2014 = quay.io/pypa/manylinux2014_i686:2024-05-10-7415d48
manylinux2014 = quay.io/pypa/manylinux2014_i686:2024-05-13-0983f6f
manylinux_2_24 = quay.io/pypa/manylinux_2_24_i686:2022-12-26-0d38463
musllinux_1_1 = quay.io/pypa/musllinux_1_1_i686:2024-05-10-7415d48
musllinux_1_2 = quay.io/pypa/musllinux_1_2_i686:2024-05-10-7415d48
musllinux_1_1 = quay.io/pypa/musllinux_1_1_i686:2024-05-13-0983f6f
musllinux_1_2 = quay.io/pypa/musllinux_1_2_i686:2024-05-13-0983f6f
[pypy_x86_64]
manylinux2010 = quay.io/pypa/manylinux2010_x86_64:2022-08-05-4535177
manylinux2014 = quay.io/pypa/manylinux2014_x86_64:2024-05-10-7415d48
manylinux2014 = quay.io/pypa/manylinux2014_x86_64:2024-05-13-0983f6f
manylinux_2_24 = quay.io/pypa/manylinux_2_24_x86_64:2022-12-26-0d38463
manylinux_2_28 = quay.io/pypa/manylinux_2_28_x86_64:2024-05-10-7415d48
manylinux_2_28 = quay.io/pypa/manylinux_2_28_x86_64:2024-05-13-0983f6f
[pypy_i686]
manylinux2010 = quay.io/pypa/manylinux2010_i686:2022-08-05-4535177
manylinux2014 = quay.io/pypa/manylinux2014_i686:2024-05-10-7415d48
manylinux2014 = quay.io/pypa/manylinux2014_i686:2024-05-13-0983f6f
manylinux_2_24 = quay.io/pypa/manylinux_2_24_i686:2022-12-26-0d38463
[aarch64]
manylinux2014 = quay.io/pypa/manylinux2014_aarch64:2024-05-10-7415d48
manylinux2014 = quay.io/pypa/manylinux2014_aarch64:2024-05-13-0983f6f
manylinux_2_24 = quay.io/pypa/manylinux_2_24_aarch64:2022-12-26-0d38463
manylinux_2_28 = quay.io/pypa/manylinux_2_28_aarch64:2024-05-10-7415d48
musllinux_1_1 = quay.io/pypa/musllinux_1_1_aarch64:2024-05-10-7415d48
musllinux_1_2 = quay.io/pypa/musllinux_1_2_aarch64:2024-05-10-7415d48
manylinux_2_28 = quay.io/pypa/manylinux_2_28_aarch64:2024-05-13-0983f6f
musllinux_1_1 = quay.io/pypa/musllinux_1_1_aarch64:2024-05-13-0983f6f
musllinux_1_2 = quay.io/pypa/musllinux_1_2_aarch64:2024-05-13-0983f6f
[ppc64le]
manylinux2014 = quay.io/pypa/manylinux2014_ppc64le:2024-05-10-7415d48
manylinux2014 = quay.io/pypa/manylinux2014_ppc64le:2024-05-13-0983f6f
manylinux_2_24 = quay.io/pypa/manylinux_2_24_ppc64le:2022-12-26-0d38463
manylinux_2_28 = quay.io/pypa/manylinux_2_28_ppc64le:2024-05-10-7415d48
musllinux_1_1 = quay.io/pypa/musllinux_1_1_ppc64le:2024-05-10-7415d48
musllinux_1_2 = quay.io/pypa/musllinux_1_2_ppc64le:2024-05-10-7415d48
manylinux_2_28 = quay.io/pypa/manylinux_2_28_ppc64le:2024-05-13-0983f6f
musllinux_1_1 = quay.io/pypa/musllinux_1_1_ppc64le:2024-05-13-0983f6f
musllinux_1_2 = quay.io/pypa/musllinux_1_2_ppc64le:2024-05-13-0983f6f
[s390x]
manylinux2014 = quay.io/pypa/manylinux2014_s390x:2024-05-10-7415d48
manylinux2014 = quay.io/pypa/manylinux2014_s390x:2024-05-13-0983f6f
manylinux_2_24 = quay.io/pypa/manylinux_2_24_s390x:2022-12-26-0d38463
manylinux_2_28 = quay.io/pypa/manylinux_2_28_s390x:2024-05-10-7415d48
musllinux_1_1 = quay.io/pypa/musllinux_1_1_s390x:2024-05-10-7415d48
musllinux_1_2 = quay.io/pypa/musllinux_1_2_s390x:2024-05-10-7415d48
manylinux_2_28 = quay.io/pypa/manylinux_2_28_s390x:2024-05-13-0983f6f
musllinux_1_1 = quay.io/pypa/musllinux_1_1_s390x:2024-05-13-0983f6f
musllinux_1_2 = quay.io/pypa/musllinux_1_2_s390x:2024-05-13-0983f6f
[pypy_aarch64]
manylinux2014 = quay.io/pypa/manylinux2014_aarch64:2024-05-10-7415d48
manylinux2014 = quay.io/pypa/manylinux2014_aarch64:2024-05-13-0983f6f
manylinux_2_24 = quay.io/pypa/manylinux_2_24_aarch64:2022-12-26-0d38463
manylinux_2_28 = quay.io/pypa/manylinux_2_28_aarch64:2024-05-10-7415d48
manylinux_2_28 = quay.io/pypa/manylinux_2_28_aarch64:2024-05-13-0983f6f
+2 -2
View File
@@ -1,2 +1,2 @@
version = "20.21.1"
url = "https://github.com/pypa/get-virtualenv/blob/20.21.1/public/virtualenv.pyz?raw=true"
py36 = { version = "20.21.1", url = "https://github.com/pypa/get-virtualenv/blob/20.21.1/public/virtualenv.pyz?raw=true" }
default = { version = "20.26.2", url = "https://github.com/pypa/get-virtualenv/blob/20.26.2/public/virtualenv.pyz?raw=true" }
+22 -7
View File
@@ -238,13 +238,17 @@ class BuildSelector:
requires_python: SpecifierSet | None = None
# a pattern that skips prerelease versions, when include_prereleases is False.
PRERELEASE_SKIP: ClassVar[str] = "cp313-*"
PRERELEASE_SKIP: ClassVar[str] = "cp313-* cp313t-*"
prerelease_pythons: bool = False
free_threaded_support: bool = False
def __call__(self, build_id: str) -> bool:
# Filter build selectors by python_requires if set
if self.requires_python is not None:
py_ver_str = build_id.split("-")[0]
if py_ver_str.endswith("t"):
py_ver_str = py_ver_str[:-1]
major = int(py_ver_str[2])
minor = int(py_ver_str[3:])
version = Version(f"{major}.{minor}.99")
@@ -255,6 +259,10 @@ class BuildSelector:
if not self.prerelease_pythons and selector_matches(self.PRERELEASE_SKIP, build_id):
return False
# filter out free threaded pythons if self.free_threaded_support is False
if not self.free_threaded_support and selector_matches("*t-*", build_id):
return False
should_build = selector_matches(self.build_config, build_id)
should_skip = selector_matches(self.skip_config, build_id)
@@ -266,6 +274,7 @@ class BuildSelector:
"skip_config": self.skip_config,
"requires_python": str(self.requires_python),
"prerelease_pythons": self.prerelease_pythons,
"free_threaded_support": self.free_threaded_support,
}
@@ -526,12 +535,15 @@ def get_pip_version(env: Mapping[str, str]) -> str:
@lru_cache(maxsize=None)
def _ensure_virtualenv() -> Path:
def _ensure_virtualenv(version: str) -> Path:
version_parts = version.split(".")
key = f"py{version_parts[0]}{version_parts[1]}"
input_file = resources_dir / "virtualenv.toml"
with input_file.open("rb") as f:
loaded_file = tomllib.load(f)
version = str(loaded_file["version"])
url = str(loaded_file["url"])
configuration = loaded_file.get(key, loaded_file["default"])
version = str(configuration["version"])
url = str(configuration["url"])
path = CIBW_CACHE_PATH / f"virtualenv-{version}.pyz"
with FileLock(str(path) + ".lock"):
if not path.exists():
@@ -587,10 +599,10 @@ def _parse_constraints_for_virtualenv(
def virtualenv(
python: Path, venv_path: Path, dependency_constraint_flags: Sequence[PathOrStr]
version: str, python: Path, venv_path: Path, dependency_constraint_flags: Sequence[PathOrStr]
) -> dict[str, str]:
assert python.exists()
virtualenv_app = _ensure_virtualenv()
virtualenv_app = _ensure_virtualenv(version)
allowed_seed_packages = ["pip", "setuptools", "wheel"]
constraints = _parse_constraints_for_virtualenv(
allowed_seed_packages, dependency_constraint_flags
@@ -642,10 +654,13 @@ def find_compatible_wheel(wheels: Sequence[T], identifier: str) -> T | None:
"""
interpreter, platform = identifier.split("-")
free_threaded = interpreter.endswith("t")
if free_threaded:
interpreter = interpreter[:-1]
for wheel in wheels:
_, _, _, tags = parse_wheel_filename(wheel.name)
for tag in tags:
if tag.abi == "abi3":
if tag.abi == "abi3" and not free_threaded:
# ABI3 wheels must start with cp3 for impl and tag
if not (interpreter.startswith("cp3") and tag.interpreter.startswith("cp3")):
continue
+23 -12
View File
@@ -44,7 +44,9 @@ from .util import (
)
def get_nuget_args(version: str, arch: str, output_directory: Path) -> list[str]:
def get_nuget_args(
version: str, arch: str, free_threaded: bool, output_directory: Path
) -> list[str]:
package_name = {
"32": "pythonx86",
"64": "python",
@@ -53,6 +55,8 @@ def get_nuget_args(version: str, arch: str, output_directory: Path) -> list[str]
"x86": "pythonx86",
"AMD64": "python",
}[arch]
if free_threaded:
package_name = f"{package_name}-freethreaded"
return [
package_name,
"-Version",
@@ -106,11 +110,16 @@ def _ensure_nuget() -> Path:
return nuget
def install_cpython(version: str, arch: str) -> Path:
def install_cpython(configuration: PythonConfiguration, arch: str | None = None) -> Path:
version = configuration.version
free_threaded = "t-" in configuration.identifier
if arch is None:
arch = configuration.arch
base_output_dir = CIBW_CACHE_PATH / "nuget-cpython"
nuget_args = get_nuget_args(version, arch, base_output_dir)
nuget_args = get_nuget_args(version, arch, free_threaded, base_output_dir)
installation_path = base_output_dir / (nuget_args[0] + "." + version) / "tools"
with FileLock(str(base_output_dir) + f"-{version}-{arch}.lock"):
free_threaded_str = "-freethreaded" if free_threaded else ""
with FileLock(str(base_output_dir) + f"-{version}{free_threaded_str}-{arch}.lock"):
if not installation_path.exists():
nuget = _ensure_nuget()
call(nuget, "install", *nuget_args)
@@ -224,18 +233,14 @@ def setup_python(
log.step(f"Installing Python {implementation_id}...")
if implementation_id.startswith("cp"):
native_arch = platform_module.machine()
base_python = install_cpython(python_configuration)
if python_configuration.arch == "ARM64" != native_arch:
# To cross-compile for ARM64, we need a native CPython to run the
# build, and a copy of the ARM64 import libraries ('.\libs\*.lib')
# for any extension modules.
python_libs_base = install_cpython(
python_configuration.version, python_configuration.arch
)
python_libs_base = python_libs_base.parent / "libs"
python_libs_base = base_python.parent / "libs"
log.step(f"Installing native Python {native_arch} for cross-compilation...")
base_python = install_cpython(python_configuration.version, native_arch)
else:
base_python = install_cpython(python_configuration.version, python_configuration.arch)
base_python = install_cpython(python_configuration, arch=native_arch)
elif implementation_id.startswith("pp"):
assert python_configuration.url is not None
base_python = install_pypy(tmp, python_configuration.arch, python_configuration.url)
@@ -246,7 +251,9 @@ def setup_python(
log.step("Setting up build environment...")
venv_path = tmp / "venv"
env = virtualenv(base_python, venv_path, dependency_constraint_flags)
env = virtualenv(
python_configuration.version, base_python, venv_path, dependency_constraint_flags
)
# set up environment variables for run_with_env
env["PYTHON_VERSION"] = python_configuration.version
@@ -519,6 +526,10 @@ def build(options: Options, tmp_path: Path) -> None:
# check that we are using the Python from the virtual environment
call("where", "python", env=virtualenv_env)
# TODO remove me once virtualenv provides pip>=24.1b1
if config.version.startswith("3.13."):
call("python", "-m", "pip", "install", "--pre", "-U", "pip", env=virtualenv_env)
if build_options.before_test:
before_test_prepared = prepare_command(
build_options.before_test,
+21 -8
View File
@@ -4,14 +4,27 @@ title: Changelog
# Changelog
### v2.18.1
- 🌟 Add free-threaded Linux and Windows builds for 3.13. New identifiers `cp313t-*`, new option `CIBW_FREE_THREADED_SUPPORT`/`tool.cibuildwheel.free-threaded-support` required to opt-in. [See the docs](https://cibuildwheel.pypa.io/en/stable/options/#free-threaded-support) for more information. (#1831)
- ✨ The `container-engine` is now a build (non-global) option. (#1792)
- 🛠 The build backend for cibuildwheel is now hatchling. (#1297)
- 🛠 Significant improvements and modernization to our noxfile. (#1823)
- 🛠 Use pylint's new GitHub Actions reporter instead of a custom matcher. (#1823)
- 🛠 Unpin virtualenv updates for Python 3.7+ (#1830)
- 🐛 Fix running linux tests from Windows or macOS ARM. (#1788)
- 📚 Fix our documentation build. (#1821)
### v2.18.0
_12 May 2024_
- ✨ Adds CPython 3.13 support, under the prerelease flag [CIBW_PRERELEASE_PYTHONS](https://cibuildwheel.pypa.io/en/stable/options/#prerelease-pythons). This version of cibuildwheel uses 3.13.0b1. Free-threading mode is not available yet, waiting on official binaries (planned for beta 2) and pip support.
- ✨ Adds CPython 3.13 support, under the prerelease flag [CIBW_PRERELEASE_PYTHONS](https://cibuildwheel.pypa.io/en/stable/options/#prerelease-pythons). This version of cibuildwheel uses 3.13.0b1. Free-threading mode is not available yet (#1657), waiting on official binaries (planned for beta 2) and pip support.
While CPython is in beta, the ABI can change, so your wheels might not be compatible with the final release. For this reason, we don't recommend distributing wheels until RC1, at which point 3.13 will be available in cibuildwheel without the flag. (#1816)
- ✨ Musllinux now defaults to `musllinux_1_2`. You can set the older `manylinux_1_1` via config if needed. (#1817)
_While CPython is in beta, the ABI can change, so your wheels might not be compatible with the final release. For this reason, we don't recommend distributing wheels until RC1, at which point 3.13 will be available in cibuildwheel without the flag._ (#1815)
- ✨ Musllinux now defaults to `musllinux_1_2`. You can set the older `musllinux_1_1` via config if needed. (#1817)
- 🛠 No longer pre-seed setuptools/wheel in virtual environments (#1819)
- 🛠 Respect the constraints file when building with pip, matching build (#1818)
- 🛠 Use uv to compile our pinned dependencies, 10x faster and doesn't require special setup (#1778)
@@ -26,14 +39,14 @@ _12 May 2024_
_11 March 2024_
- 🌟 Adds the ability to inherit configuration in TOML overrides. This makes certain configurations much simpler. If you're overriding an option like `before-build` or `environment`, and you just want to add an extra command or environment variable, you can just append (or prepend) to the previous config. See [the docs](https://cibuildwheel.pypa.io/en/stable/options/#inherit) for more information. (#1730)
- 🌟 Adds official support for native arm64 macOS GitHub runners. To use them, just specify `macos-14` as an `os` of your job in your workflow file. You can also keep `macos-13` in your build matrix to build x86_64. Check out the new [GitHub Actions example config](https://cibuildwheel.pypa.io/en/stable/setup/#github-actions).
- 🌟 Adds official support for native `arm64` macOS GitHub runners. To use them, just specify `macos-14` as an `os` of your job in your workflow file. You can also keep `macos-13` in your build matrix to build `x86_64`. Check out the new [GitHub Actions example config](https://cibuildwheel.pypa.io/en/stable/setup/#github-actions).
- ✨ You no longer need to specify `--platform` to run cibuildwheel locally! Instead it will detect your platform automatically. This was a safety feature, no longer necessary. (#1727)
- 🛠 Removed setuptools and wheel pinned versions. This only affects old-style projects without a `pyproject.toml`, projects with `pyproject.toml` are already getting fresh versions of their `build-system.requires` installed into an isolated environment. (#1725)
- 🛠 Improve how the GitHub Action passes arguments (#1757)
- 🛠 Remove a system-wide install of pipx in the GitHub Action (#1745)
- 🐛 No longer will cibuildwheel override the PIP_CONSTRAINT environment variable when using the `build` frontend. Instead it will be extended. (#1675)
- 🐛 Fix a bug where building and testing both x86_86 and arm64 wheels on the same runner caused the wrong architectures in the test environment (#1750)
- 🐛 Fix a bug that prevented testing a CPython 3.8 wheel targeting macOS 11+ on x86_64 (#1768)
- 🐛 No longer will cibuildwheel override the `PIP_CONSTRAINT` environment variable when using the `build` frontend. Instead it will be extended. (#1675)
- 🐛 Fix a bug where building and testing both `x86_86` and `arm64` wheels on the same runner caused the wrong architectures in the test environment (#1750)
- 🐛 Fix a bug that prevented testing a CPython 3.8 wheel targeting macOS 11+ on `x86_64` (#1768)
- 📚 Moved the docs onto the official PyPA domain - they're now available at https://cibuildwheel.pypa.io . (#1775)
- 📚 Docs and examples improvements (#1762, #1734)
@@ -110,7 +123,7 @@ _10 July 2023_
- 🛠 Updates the prerelease CPython 3.12 version to 3.12.0b3.
- ✨ Allow the use of the `{wheel}` placeholder in CIBW_TEST_COMMAND (#1533)
- 📚 Docs & examples updates (#1532, #1416)
- ⚠️ Removed support for running cibuildwheel in Python 3.7. Python 3.7 is EOL. However, cibuildwheel continues to build Python 3.7 wheels for the moment. (#1175)
- ⚠️ Removed support for running cibuildwheel in Python 3.7. Python 3.7 is EOL. However, cibuildwheel continues to build Python 3.7 wheels for the moment. (#1175)
### v2.13.1
+7 -7
View File
@@ -26,7 +26,7 @@
notes: A simple C extension, without external dependencies
- name: websockets
gh: aaugustin/websockets
gh: python-websockets/websockets
ci: [travisci]
ci_config: .travis.yml
os: [apple, linux]
@@ -325,12 +325,12 @@
notes: Full range of wheels for setuptools rust, with auto release and PyPI deploy.
- name: python-snappy
gh: andrix/python-snappy
gh: intake/python-snappy
ci: [github]
os: [apple, linux, windows]
- name: sourmash
gh: dib-lab/sourmash
gh: sourmash-bio/sourmash
ci: [github]
os: [apple, linux, windows]
@@ -418,7 +418,7 @@
notes: Tornado is a Python web framework and asynchronous networking library. Uses stable ABI for a small C extension.
- name: pytorch-fairseq
gh: pytorch/fairseq
gh: facebookresearch/fairseq
ci: [github]
os: [apple, linux]
@@ -475,7 +475,7 @@
os: [apple, linux, windows]
- name: OpenSpiel
gh: deepmind/open_spiel
gh: google-deepmind/open_spiel
ci: [github]
os: [apple, linux]
@@ -505,7 +505,7 @@
os: [apple, linux, windows]
- name: OpenTimelineIO
gh: PixarAnimationStudios/OpenTimelineIO
gh: AcademySoftwareFoundation/OpenTimelineIO
ci: [github]
os: [apple, linux, windows]
@@ -584,7 +584,7 @@
notes: Includes GPU support for linux wheels
- name: power-grid-model
gh: alliander-opensource/power-grid-model
gh: PowerGridModel/power-grid-model
ci: [github]
os: [windows, apple, linux]
notes: Python/C++ library for distribution power system analysis
+3 -3
View File
@@ -142,7 +142,7 @@ There are two suggested methods for keeping cibuildwheel up to date that instead
If you use GitHub Actions for builds, you can use cibuildwheel as an action:
```yaml
uses: pypa/cibuildwheel@v2.18.0
uses: pypa/cibuildwheel@v2.18.1
```
This is a composite step that just runs cibuildwheel using pipx. You can set command-line options as `with:` parameters, and use `env:` as normal.
@@ -164,7 +164,7 @@ The second option, and the only one that supports other CI systems, is using a `
```bash
# requirements-cibw.txt
cibuildwheel==2.18.0
cibuildwheel==2.18.1
```
Then your install step would have `python -m pip install -r requirements-cibw.txt` in it. Your `.github/dependabot.yml` file could look like this:
@@ -328,7 +328,7 @@ Solutions to this vary, but the simplest is to use pipx:
# most runners have pipx preinstalled, but in case you don't
python3 -m pip install pipx
pipx run cibuildwheel==2.18.0 --output-dir wheelhouse
pipx run cibuildwheel==2.18.1 --output-dir wheelhouse
pipx run twine upload wheelhouse/*.whl
```
+6 -3
View File
@@ -1,10 +1,10 @@
from __future__ import annotations
import os
import subprocess
import sysconfig
from typing import Any
# Requires Python 3.7+
def define_env(env: Any) -> None:
"Hook function for mkdocs-macros"
@@ -12,4 +12,7 @@ def define_env(env: Any) -> None:
@env.macro
def subprocess_run(*args: str) -> str:
"Run a subprocess and return the stdout"
return subprocess.run(args, check=True, capture_output=True, text=True).stdout
env = os.environ.copy()
scripts = sysconfig.get_path("scripts")
env["PATH"] = f"{scripts}{os.pathsep}{env.get('PATH', '')}"
return subprocess.run(args, check=True, capture_output=True, text=True, env=env).stdout
+47
View File
@@ -408,6 +408,53 @@ See the [cibuildwheel 1 documentation](https://cibuildwheel.pypa.io/en/1.x/) for
}
</style>
### `CIBW_FREE_THREADED_SUPPORT` {: #free-threaded-support}
> Choose whether free-threaded variants should be built
[PEP 703](https://www.python.org/dev/peps/pep-0703) introduced variants of CPython that can be built without the Global Interpreter Lock (GIL).
Those variants are also known as free-threaded / no-gil.
Building for free-threaded variants is disabled by default.
Building can be enabled by setting this option to `true`. The free-threaded compatible wheels will be built in addition to the standard wheels.
This option doesn't support overrides.
If you need to enable/disable it per platform or python version, set this option to `true` and use [`CIBW_BUILD`](#build-skip)/[`CIBW_SKIP`](#build-skip) options to filter the builds.
The build identifiers for those variants have a `t` suffix in their `python_tag` (e.g. `cp313t-manylinux_x86_64`)
!!! note
This feature is experimental: [Whats New In Python 3.13](https://docs.python.org/3.13/whatsnew/3.13.html#free-threaded-cpython)
#### Examples
!!! tab examples "Environment variables"
```yaml
# Enable free-threaded support
CIBW_FREE_THREADED_SUPPORT: 1
# Skip building free-threaded compatible wheels on Windows
CIBW_FREE_THREADED_SUPPORT: 1
CIBW_SKIP: *t-win*
```
It is generally recommended to use `free-threaded-support` in a config file as you can statically declare that you
support free-threaded builds.
!!! tab examples "pyproject.toml"
```toml
[tool.cibuildwheel]
# Enable free-threaded support
free-threaded-support = true
# Skip building free-threaded compatible wheels on Windows
free-threaded-support = true
skip = "*t-win*"
```
### `CIBW_ARCHS` {: #archs}
> Change the architectures built on your machine by default.
+2 -2
View File
@@ -154,7 +154,7 @@ To build Linux, Mac, and Windows wheels using GitHub Actions, create a `.github/
- uses: actions/checkout@v4
- name: Build wheels
run: pipx run cibuildwheel==2.18.0
run: pipx run cibuildwheel==2.18.1
- uses: actions/upload-artifact@v4
with:
@@ -191,7 +191,7 @@ To build Linux, Mac, and Windows wheels using GitHub Actions, create a `.github/
- uses: actions/setup-python@v5
- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.18.0
run: python -m pip install cibuildwheel==2.18.1
- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse
+12 -12
View File
@@ -16,8 +16,8 @@ title: Working examples
| [NCNN][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | ncnn is a high-performance neural network inference framework optimized for the mobile platform |
| [Prophet][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | Tool for producing high quality forecasts for time series data that has multiple seasonality with linear or non-linear growth. |
| [MyPy][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | The compiled version of MyPy using MyPyC. |
| [Kivy][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | Open source UI framework written in Python, running on Windows, Linux, macOS, Android and iOS |
| [duckdb][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | DuckDB is an in-process SQL OLAP Database Management System |
| [Kivy][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | Open source UI framework written in Python, running on Windows, Linux, macOS, Android and iOS |
| [MemRay][] | ![github icon][] | ![linux icon][] | Memray is a memory profiler for Python |
| [Triton][] | ![github icon][] | ![linux icon][] | Self hosted runners |
| [uvloop][] | ![github icon][] | ![apple icon][] ![linux icon][] | Ultra fast asyncio event loop. |
@@ -44,8 +44,8 @@ title: Working examples
| [Implicit][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | Includes GPU support for linux wheels |
| [vispy][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | Main repository for Vispy |
| [tinyobjloader][] | ![azurepipelines icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | Tiny but powerful single file wavefront obj loader |
| [coverage.py][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | The coverage tool for Python |
| [CTranslate2][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | Includes libraries from the [Intel oneAPI toolkit](https://www.intel.com/content/www/us/en/developer/tools/oneapi/base-toolkit.html) and CUDA kernels compiled for multiple GPU architectures. |
| [coverage.py][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | The coverage tool for Python |
| [PyCryptodome][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | A self-contained cryptographic library for Python |
| [Line Profiler][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | Line-by-line profiling for Python |
| [PyYAML][] | ![github icon][] | ![apple icon][] | Canonical source repository for PyYAML |
@@ -79,8 +79,8 @@ title: Working examples
| [tgcalls][] | ![github icon][] | ![apple icon][] ![windows icon][] | Python `pybind11` binding to Telegram's WebRTC library with third party dependencies like `OpenSSL`, `MozJPEG`, `FFmpeg`, etc. |
| [python-snappy][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | Python bindings for the snappy google library |
| [pybind11 python_example][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | Example pybind11 module built with a Python-based build system |
| [sourmash][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | Quickly search, compare, and analyze genomic and metagenomic data sets. |
| [abess][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | A fast best-subset selection library. It uses cibuildwheel to build a large project with C++ extensions. |
| [sourmash][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | Quickly search, compare, and analyze genomic and metagenomic data sets. |
| [cyvcf2][] | ![github icon][] | ![apple icon][] ![linux icon][] | cython + htslib == fast VCF and BCF processing |
| [matrixprofile][] | ![travisci icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | A Python 3 library making time series data mining tasks, utilizing matrix profile algorithms, accessible to everyone. |
| [jq.py][] | ![travisci icon][] | ![apple icon][] ![linux icon][] | Python bindings for jq |
@@ -118,15 +118,15 @@ title: Working examples
| [pybind11 cross build example][] | ![github icon][] ![gitlab icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | Same as pybind11 cmake_example but used to demo Linux ARM + Windows + macOS builds on GitLab |
[scikit-learn]: https://github.com/scikit-learn/scikit-learn
[pytorch-fairseq]: https://github.com/pytorch/fairseq
[pytorch-fairseq]: https://github.com/facebookresearch/fairseq
[NumPy]: https://github.com/numpy/numpy
[Tornado]: https://github.com/tornadoweb/tornado
[Matplotlib]: https://github.com/matplotlib/matplotlib
[NCNN]: https://github.com/Tencent/ncnn
[Prophet]: https://github.com/facebook/prophet
[MyPy]: https://github.com/mypyc/mypy_mypyc-wheels
[Kivy]: https://github.com/kivy/kivy
[duckdb]: https://github.com/duckdb/duckdb
[Kivy]: https://github.com/kivy/kivy
[MemRay]: https://github.com/bloomberg/memray
[Triton]: https://github.com/openai/triton
[uvloop]: https://github.com/MagicStack/uvloop
@@ -141,11 +141,11 @@ title: Working examples
[twisted-iocpsupport]: https://github.com/twisted/twisted-iocpsupport
[PyOxidizer]: https://github.com/indygreg/PyOxidizer
[cvxpy]: https://github.com/cvxpy/cvxpy
[websockets]: https://github.com/aaugustin/websockets
[websockets]: https://github.com/python-websockets/websockets
[pedalboard]: https://github.com/spotify/pedalboard
[River]: https://github.com/online-ml/river
[UltraJSON]: https://github.com/ultrajson/ultrajson
[OpenSpiel]: https://github.com/deepmind/open_spiel
[OpenSpiel]: https://github.com/google-deepmind/open_spiel
[aiortc]: https://github.com/aiortc/aiortc
[Confluent client for Kafka]: https://github.com/confluentinc/confluent-kafka-python
[Dependency Injector]: https://github.com/ets-labs/python-dependency-injector
@@ -153,8 +153,8 @@ title: Working examples
[Implicit]: https://github.com/benfred/implicit
[vispy]: https://github.com/vispy/vispy
[tinyobjloader]: https://github.com/tinyobjloader/tinyobjloader
[coverage.py]: https://github.com/nedbat/coveragepy
[CTranslate2]: https://github.com/OpenNMT/CTranslate2
[coverage.py]: https://github.com/nedbat/coveragepy
[PyCryptodome]: https://github.com/Legrandin/pycryptodome
[Line Profiler]: https://github.com/pyutils/line_profiler
[PyYAML]: https://github.com/yaml/pyyaml
@@ -169,7 +169,7 @@ title: Working examples
[aioquic]: https://github.com/aiortc/aioquic
[Psycopg 3]: https://github.com/psycopg/psycopg
[ruptures]: https://github.com/deepcharles/ruptures
[OpenTimelineIO]: https://github.com/PixarAnimationStudios/OpenTimelineIO
[OpenTimelineIO]: https://github.com/AcademySoftwareFoundation/OpenTimelineIO
[PyTables]: https://github.com/PyTables/PyTables
[Parselmouth]: https://github.com/YannickJadoul/Parselmouth
[google neuroglancer]: https://github.com/google/neuroglancer
@@ -186,10 +186,10 @@ title: Working examples
[dd-trace-py]: https://github.com/DataDog/dd-trace-py
[python-rapidjson]: https://github.com/python-rapidjson/python-rapidjson
[tgcalls]: https://github.com/MarshalX/tgcalls
[python-snappy]: https://github.com/andrix/python-snappy
[python-snappy]: https://github.com/intake/python-snappy
[pybind11 python_example]: https://github.com/pybind/python_example
[sourmash]: https://github.com/dib-lab/sourmash
[abess]: https://github.com/abess-team/abess
[sourmash]: https://github.com/sourmash-bio/sourmash
[cyvcf2]: https://github.com/brentp/cyvcf2
[matrixprofile]: https://github.com/matrix-profile-foundation/matrixprofile
[jq.py]: https://github.com/mwilliamson/jq.py
@@ -203,7 +203,7 @@ title: Working examples
[bx-python]: https://github.com/bxlab/bx-python
[boost-histogram]: https://github.com/scikit-hep/boost-histogram
[Python-WebRTC]: https://github.com/MarshalX/python-webrtc
[power-grid-model]: https://github.com/alliander-opensource/power-grid-model
[power-grid-model]: https://github.com/PowerGridModel/power-grid-model
[pybase64]: https://github.com/mayeut/pybase64
[fathon]: https://github.com/stfbnc/fathon
[Imagecodecs (fork)]: https://github.com/czaki/imagecodecs_build
+1 -1
View File
@@ -12,7 +12,7 @@ stack: python 3.7
init:
- cmd: set PATH=C:\Python37;C:\Python37\Scripts;%PATH%
install: python -m pip install cibuildwheel==2.18.0
install: python -m pip install cibuildwheel==2.18.1
build_script: python -m cibuildwheel --output-dir wheelhouse
+3 -3
View File
@@ -6,7 +6,7 @@ jobs:
- bash: |
set -o errexit
python3 -m pip install --upgrade pip
pip3 install cibuildwheel==2.18.0
pip3 install cibuildwheel==2.18.1
displayName: Install dependencies
- bash: cibuildwheel --output-dir wheelhouse .
displayName: Build wheels
@@ -20,7 +20,7 @@ jobs:
- bash: |
set -o errexit
python3 -m pip install --upgrade pip
python3 -m pip install cibuildwheel==2.18.0
python3 -m pip install cibuildwheel==2.18.1
displayName: Install dependencies
- bash: cibuildwheel --output-dir wheelhouse .
displayName: Build wheels
@@ -34,7 +34,7 @@ jobs:
- bash: |
set -o errexit
python -m pip install --upgrade pip
pip install cibuildwheel==2.18.0
pip install cibuildwheel==2.18.1
displayName: Install dependencies
- bash: cibuildwheel --output-dir wheelhouse .
displayName: Build wheels
+3 -3
View File
@@ -11,7 +11,7 @@ jobs:
- run:
name: Build the Linux wheels.
command: |
pip3 install --user cibuildwheel==2.18.0
pip3 install --user cibuildwheel==2.18.1
cibuildwheel --output-dir wheelhouse
- store_artifacts:
path: wheelhouse/
@@ -28,7 +28,7 @@ jobs:
- run:
name: Build the Linux aarch64 wheels.
command: |
python3 -m pip install --user cibuildwheel==2.18.0
python3 -m pip install --user cibuildwheel==2.18.1
python3 -m cibuildwheel --output-dir wheelhouse
- store_artifacts:
path: wheelhouse/
@@ -42,7 +42,7 @@ jobs:
- run:
name: Build the OS X wheels.
command: |
pip3 install cibuildwheel==2.18.0
pip3 install cibuildwheel==2.18.1
cibuildwheel --output-dir wheelhouse
- store_artifacts:
path: wheelhouse/
+1 -1
View File
@@ -1,6 +1,6 @@
build_and_store_wheels: &BUILD_AND_STORE_WHEELS
install_cibuildwheel_script:
- python -m pip install cibuildwheel==2.18.0
- python -m pip install cibuildwheel==2.18.1
run_cibuildwheel_script:
- cibuildwheel
wheels_artifacts:
+1 -1
View File
@@ -1,6 +1,6 @@
build_and_store_wheels: &BUILD_AND_STORE_WHEELS
install_cibuildwheel_script:
- python -m pip install cibuildwheel==2.18.0
- python -m pip install cibuildwheel==2.18.1
run_cibuildwheel_script:
- cibuildwheel
wheels_artifacts:
+1 -1
View File
@@ -23,7 +23,7 @@ jobs:
- uses: actions/checkout@v4
- name: Build wheels
uses: pypa/cibuildwheel@v2.18.0
uses: pypa/cibuildwheel@v2.18.1
- uses: actions/upload-artifact@v4
with:
+1 -1
View File
@@ -15,7 +15,7 @@ jobs:
- uses: actions/checkout@v4
- name: Build wheels
uses: pypa/cibuildwheel@v2.18.0
uses: pypa/cibuildwheel@v2.18.1
# env:
# CIBW_SOME_OPTION: value
# ...
+1 -1
View File
@@ -21,7 +21,7 @@ jobs:
platforms: all
- name: Build wheels
uses: pypa/cibuildwheel@v2.18.0
uses: pypa/cibuildwheel@v2.18.1
env:
# configure cibuildwheel to build native archs ('auto'), and some
# emulated ones
+2 -2
View File
@@ -12,7 +12,7 @@ linux:
DOCKER_TLS_CERTDIR: ""
script:
- curl -sSL https://get.docker.com/ | sh
- python -m pip install cibuildwheel==2.18.0
- python -m pip install cibuildwheel==2.18.1
- cibuildwheel --output-dir wheelhouse
artifacts:
paths:
@@ -23,7 +23,7 @@ windows:
before_script:
- choco install python -y --version 3.8.6
- choco install git.install -y
- py -m pip install cibuildwheel==2.18.0
- py -m pip install cibuildwheel==2.18.1
script:
- py -m cibuildwheel --output-dir wheelhouse --platform windows
artifacts:
+1 -1
View File
@@ -14,7 +14,7 @@ linux:
- curl -sSL https://get.docker.com/ | sh
# Warning: This is extremely slow, be careful with how many wheels you build
- docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
- python -m pip install cibuildwheel==2.18.0
- python -m pip install cibuildwheel==2.18.1
# Assuming your CI runner's default architecture is x86_64...
- cibuildwheel --output-dir wheelhouse --platform linux --archs aarch64
artifacts:
+1 -1
View File
@@ -20,7 +20,7 @@ jobs:
- ln -s /c/Python38/python.exe /c/Python38/python3.exe
install:
- python3 -m pip install cibuildwheel==2.18.0
- python3 -m pip install cibuildwheel==2.18.1
script:
# build the wheels, put them into './dist'
+1 -1
View File
@@ -26,7 +26,7 @@ jobs:
- ln -s /c/Python38/python.exe /c/Python38/python3.exe
install:
- python3 -m pip install cibuildwheel==2.18.0
- python3 -m pip install cibuildwheel==2.18.1
script:
# build the wheels, put them into './wheelhouse'
+2 -2
View File
@@ -54,7 +54,7 @@ jobs:
- stage: deploy
name: Build and deploy Linux wheels
services: docker
install: python3 -m pip install cibuildwheel==2.18.0 twine
install: python3 -m pip install cibuildwheel==2.18.1 twine
script: python3 -m cibuildwheel --output-dir wheelhouse
after_success: python3 -m twine upload --skip-existing wheelhouse/*.whl
# Deploy on windows
@@ -62,7 +62,7 @@ jobs:
name: Build and deploy Windows wheels
os: windows
language: shell
install: python3 -m pip install cibuildwheel==2.18.0 twine
install: python3 -m pip install cibuildwheel==2.18.1 twine
script: python3 -m cibuildwheel --output-dir wheelhouse
after_success: python3 -m twine upload --skip-existing wheelhouse/*.whl
+2
View File
@@ -49,3 +49,5 @@ plugins:
module_name: docs/main
j2_variable_start_string: «
j2_variable_end_string: »
on_error_fail: true
on_undefined: strict
+26 -15
View File
@@ -4,15 +4,21 @@ import os
import shutil
import sys
from pathlib import Path
from typing import Any
import nox
nox.needs_version = ">=2024.4.15"
nox.options.sessions = ["lint", "pylint", "check_manifest", "tests"]
nox.options.default_venv_backend = "uv|virtualenv"
DIR = Path(__file__).parent.resolve()
if os.environ.get("CI", None):
nox.options.error_on_missing_interpreters = True
def install_and_run(session: nox.Session, script: str, *args: str, **kwargs: Any) -> str | None:
deps = nox.project.load_toml(script)["dependencies"]
session.install(*deps)
return session.run("python", script, *args, **kwargs)
@nox.session
@@ -20,11 +26,11 @@ def tests(session: nox.Session) -> None:
"""
Run the unit and regular tests.
"""
unit_test_args = ["--run-docker"] if sys.platform.startswith("linux") else []
session.install("-e.[test]")
if session.posargs:
session.run("pytest", *session.posargs)
else:
unit_test_args = ["--run-docker"] if sys.platform.startswith("linux") else []
session.run("pytest", "unit_test", *unit_test_args)
session.run("pytest", "test", "-x", "--durations", "0", "--timeout=2400", "test")
@@ -44,8 +50,7 @@ def pylint(session: nox.Session) -> None:
Run pylint.
"""
name = "cibuildwheel @ ." if getattr(session.virtualenv, "venv_backend", "") == "uv" else "."
session.install("pylint", name)
session.install("pylint>=3.2", "-e.")
session.run("pylint", "cibuildwheel", *session.posargs)
@@ -65,7 +70,7 @@ def update_constraints(session: nox.Session) -> None:
Update the dependencies inplace.
"""
if getattr(session.virtualenv, "venv_backend", "") != "uv":
if session.venv_backend != "uv":
session.install("uv>=0.1.23")
for minor_version in range(7, 14):
@@ -96,20 +101,19 @@ def update_pins(session: nox.Session) -> None:
"""
Update the python, docker and virtualenv pins version inplace.
"""
session.install("-e", ".[bin]")
session.install("-e.[bin]")
session.run("python", "bin/update_pythons.py", "--force")
session.run("python", "bin/update_docker.py")
session.run("python", "bin/update_virtualenv.py", "--force")
@nox.session
@nox.session(reuse_venv=True)
def update_proj(session: nox.Session) -> None:
"""
Update the README inplace.
"""
session.install("-e.[bin]")
session.run(
"python",
install_and_run(
session,
"bin/projects.py",
"docs/data/projects.yml",
*session.posargs,
@@ -121,19 +125,26 @@ def generate_schema(session: nox.Session) -> None:
"""
Generate the cibuildwheel.schema.json file.
"""
session.install("pyyaml")
output = session.run("python", "bin/generate_schema.py", silent=True)
output = install_and_run(session, "bin/generate_schema.py", silent=True)
assert isinstance(output, str)
DIR.joinpath("cibuildwheel/resources/cibuildwheel.schema.json").write_text(output)
@nox.session(python="3.9")
@nox.session(reuse_venv=True)
def bump_version(session: nox.Session) -> None:
"""
Bump cibuildwheel's version. Interactive.
"""
install_and_run(session, "bin/bump_version.py")
@nox.session(python="3.12")
def docs(session: nox.Session) -> None:
"""
Build the docs. Will serve unless --non-interactive
"""
session.install("-e.[docs]")
session.run("mkdocs", "serve" if session.interactive else "build")
session.run("mkdocs", "serve" if session.interactive else "build", "--strict", *session.posargs)
@nox.session
+90 -19
View File
@@ -1,9 +1,94 @@
[build-system]
requires = [
"setuptools>=42",
]
build-backend = "setuptools.build_meta"
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "cibuildwheel"
version = "2.18.1"
description = "Build Python wheels on CI with minimal configuration."
readme = "README.md"
license = "BSD-2-Clause"
requires-python = ">=3.8"
authors = [
{ name = "Joe Rickerby", email = "joerick@mac.com" },
]
keywords = [
"appveyor",
"ci",
"linux",
"macos",
"packaging",
"pypi",
"travis",
"wheel",
"windows",
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Natural Language :: English",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"Topic :: Software Development :: Build Tools",
]
dependencies = [
"bashlex!=0.13",
"bracex",
"certifi",
"filelock",
"packaging>=20.9",
"platformdirs",
"tomli;python_version < '3.11'",
"typing-extensions>=4.1.0;python_version < '3.11'",
]
[project.optional-dependencies]
bin = [
"click",
"packaging>=21.0",
"pip-tools",
"pygithub",
"pyyaml",
"requests",
"rich>=9.6",
]
dev = [
"cibuildwheel[test,bin]",
]
docs = [
"jinja2>=3.1.2",
"mkdocs-include-markdown-plugin==2.8.0",
"mkdocs-macros-plugin",
"mkdocs==1.3.1",
"pymdown-extensions",
]
test = [
"build",
"jinja2",
"pytest-timeout",
"pytest-xdist",
"pytest>=6",
"tomli_w",
"validate-pyproject",
]
[project.scripts]
cibuildwheel = "cibuildwheel.__main__:main"
[project.entry-points."validate_pyproject.tool_schema"]
cibuildwheel = "cibuildwheel.schema:get_schema"
[project.urls]
Changelog = "https://github.com/pypa/cibuildwheel#changelog"
Documentation = "https://cibuildwheel.pypa.io"
Homepage = "https://github.com/pypa/cibuildwheel"
[tool.pytest.ini_options]
minversion = "6.0"
@@ -57,21 +142,6 @@ module = [
ignore_missing_imports = true
[tool.check-manifest]
ignore = [
".*",
".circleci/**",
"test/**",
"unit_test/**",
"docs/**",
"examples/**",
"bin/**",
"*.yml",
"CI.md", # TODO: can change test/test_ssl and remove this
"requirements-dev.txt",
"noxfile.py",
]
[tool.pylint]
py-version = "3.8"
jobs = "0"
@@ -162,6 +232,7 @@ flake8-unused-arguments.ignore-variadic-names = true
[tool.ruff.lint.per-file-ignores]
"unit_test/*" = ["PLC1901"]
"cibuildwheel/_compat/**.py" = ["TID251"]
"bin/*" = ["TID251"]
[tool.repo-review]
ignore = ["PC170", "PP303"]
-57
View File
@@ -1,57 +0,0 @@
[metadata]
name = cibuildwheel
version = 2.18.0
description = Build Python wheels on CI with minimal configuration.
long_description = file: README.md
long_description_content_type = text/markdown
url = https://github.com/pypa/cibuildwheel
author = Joe Rickerby
author_email = joerick@mac.com
license = BSD-2-Clause
license_files = LICENSE
classifiers =
Development Status :: 5 - Production/Stable
Intended Audience :: Developers
License :: OSI Approved :: BSD License
Natural Language :: English
Programming Language :: Python :: 3
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
Programming Language :: Python :: Implementation :: CPython
Topic :: Software Development :: Build Tools
keywords = ci,wheel,packaging,pypi,travis,appveyor,macos,linux,windows
project_urls =
Changelog=https://github.com/pypa/cibuildwheel#changelog
Documentation=https://cibuildwheel.pypa.io/
[options]
packages = find:
install_requires =
bashlex!=0.13
bracex
certifi
filelock
packaging>=20.9
platformdirs
tomli;python_version < '3.11'
typing-extensions>=4.1.0;python_version < '3.11'
python_requires = >=3.8
include_package_data = True
zip_safe = False
[options.packages.find]
include =
cibuildwheel
[options.entry_points]
console_scripts =
cibuildwheel = cibuildwheel.__main__:main
validate_pyproject.tool_schema =
cibuildwheel = cibuildwheel.schema:get_schema
[options.package_data]
cibuildwheel = resources/*
-38
View File
@@ -1,38 +0,0 @@
from __future__ import annotations
from setuptools import setup
extras = {
"docs": [
"mkdocs-include-markdown-plugin==2.8.0",
"mkdocs==1.3.1",
"jinja2>=3.1.2",
"pymdown-extensions",
"mkdocs-macros-plugin",
],
"test": [
"jinja2",
"pytest>=6",
"pytest-timeout",
"pytest-xdist",
"build",
"tomli_w",
"validate-pyproject",
],
"bin": [
"click",
"pip-tools",
"pygithub",
"pyyaml",
"requests",
"rich>=9.6",
"packaging>=21.0",
],
}
extras["dev"] = [
*extras["test"],
*extras["bin"],
]
setup(extras_require=extras)
+12 -4
View File
@@ -13,9 +13,14 @@ build-backend = "setuptools.build_meta"
limited_api_project = test_projects.new_c_project(
setup_py_add=textwrap.dedent(
r"""
import sysconfig
IS_CPYTHON = sys.implementation.name == "cpython"
Py_GIL_DISABLED = sysconfig.get_config_var("Py_GIL_DISABLED")
CAN_USE_ABI3 = IS_CPYTHON and not Py_GIL_DISABLED
cmdclass = {}
extension_kwargs = {}
if sys.version_info[:2] >= (3, 8):
if CAN_USE_ABI3 and sys.version_info[:2] >= (3, 8):
from wheel.bdist_wheel import bdist_wheel as _bdist_wheel
class bdist_wheel_abi3(_bdist_wheel):
@@ -47,7 +52,8 @@ def test_abi3(tmp_path):
actual_wheels = utils.cibuildwheel_run(
project_dir,
add_env={
"CIBW_SKIP": "pp* ", # PyPy does not have a Py_LIMITED_API equivalent
# free_threaded and PyPy do not have a Py_LIMITED_API equivalent, just build one of those
"CIBW_BUILD": "cp3?-* cp31?-* cp313t-* pp310-*"
},
)
@@ -55,7 +61,9 @@ def test_abi3(tmp_path):
expected_wheels = [
w.replace("cp38-cp38", "cp38-abi3")
for w in utils.expected_wheels("spam", "0.1.0")
if "-pp" not in w and "-cp39" not in w and "-cp31" not in w
if ("-pp310" in w or "-pp" not in w)
and "-cp39" not in w
and ("-cp313t" in w or "-cp31" not in w)
]
assert set(actual_wheels) == set(expected_wheels)
@@ -177,7 +185,7 @@ def test_abi_none(tmp_path, capfd):
"CIBW_TEST_REQUIRES": "pytest",
"CIBW_TEST_COMMAND": "pytest {project}/test",
# limit the number of builds for test performance reasons
"CIBW_BUILD": "cp38-* cp310-* pp39-*",
"CIBW_BUILD": "cp38-* cp310-* cp313t-* pp310-*",
},
)
-1
View File
@@ -111,7 +111,6 @@ def test_dependency_constraints_file(tmp_path, build_frontend_env):
"""
pip=={pip}
delocate=={delocate}
importlib-metadata<3,>=0.12; python_version < "3.8"
""".format(**tool_versions)
)
)
+3 -1
View File
@@ -202,13 +202,15 @@ def test_universal2_testing_on_arm64(tmp_path, capfd):
assert set(actual_wheels) == set(expected_wheels)
def test_cp38_arm64_testing(tmp_path, capfd):
def test_cp38_arm64_testing(tmp_path, capfd, request):
if utils.platform != "macos":
pytest.skip("this test is only relevant to macos")
if get_xcode_version() < (12, 2):
pytest.skip("this test only works with Xcode 12.2 or greater")
if platform.machine() != "arm64":
pytest.skip("this test only works on arm64")
if request.config.getoption("--run-cp38-universal2"):
pytest.skip("--run-cp38-universal2 option skips this test")
project_dir = tmp_path / "project"
basic_project.generate(project_dir)
+10
View File
@@ -37,6 +37,9 @@ def cibuildwheel_get_build_identifiers(project_path, env=None, *, prerelease_pyt
cmd = [sys.executable, "-m", "cibuildwheel", "--print-build-identifiers", str(project_path)]
if prerelease_pythons:
cmd.append("--prerelease-pythons")
if env is None:
env = os.environ.copy()
env.setdefault("CIBW_FREE_THREADED_SUPPORT", "1")
cmd_output = subprocess.run(
cmd,
@@ -94,6 +97,8 @@ def cibuildwheel_run(
_update_pip_cache_dir(env)
env.setdefault("CIBW_FREE_THREADED_SUPPORT", "1")
with TemporaryDirectory() as tmp_output_dir:
subprocess.run(
[
@@ -147,6 +152,9 @@ def expected_wheels(
if machine_arch is None:
machine_arch = pm.machine()
if platform == "linux" and machine_arch.lower() == "arm64":
# we're running linux tests from macOS/Windows arm64, override platform
machine_arch = "aarch64"
if manylinux_versions is None:
if machine_arch == "x86_64":
@@ -173,6 +181,8 @@ def expected_wheels(
"cp312-cp312",
"cp313-cp313",
]
if platform != "macos":
python_abi_tags.append("cp313-cp313t")
if machine_arch in ["x86_64", "AMD64", "x86", "aarch64"]:
python_abi_tags += [
+9
View File
@@ -50,6 +50,7 @@ def test_build_filter_pre():
assert build_selector("cp313-manylinux_x86_64")
assert build_selector("cp37-win_amd64")
assert build_selector("cp313-win_amd64")
assert not build_selector("cp313t-manylinux_x86_64")
def test_skip():
@@ -144,6 +145,14 @@ def test_build_limited_python_patch():
assert build_selector("cp37-manylinux_x86_64")
def test_build_free_threaded_python():
build_selector = BuildSelector(
build_config="*", skip_config="", prerelease_pythons=True, free_threaded_support=True
)
assert build_selector("cp313t-manylinux_x86_64")
def test_testing_selector():
# local import to avoid pytest trying to collect this as a test class!
from cibuildwheel.util import TestSelector
+25 -7
View File
@@ -5,13 +5,13 @@ from pathlib import Path
from pprint import pprint
import cibuildwheel.linux
import cibuildwheel.oci_container
from cibuildwheel.oci_container import OCIContainerEngineConfig
from cibuildwheel.options import CommandLineArguments, Options
def test_linux_container_split(tmp_path: Path, monkeypatch):
"""
Tests splitting linux builds by container image and before_all
Tests splitting linux builds by container image, container engine, and before_all
"""
args = CommandLineArguments.defaults()
@@ -28,13 +28,17 @@ def test_linux_container_split(tmp_path: Path, monkeypatch):
archs = "x86_64 i686"
[[tool.cibuildwheel.overrides]]
select = "cp{38,39,310}-*"
select = "cp{37,38,39,310}-*"
manylinux-x86_64-image = "other_container_image"
manylinux-i686-image = "other_container_image"
[[tool.cibuildwheel.overrides]]
select = "cp39-*"
before-all = "echo 'a cp39-only command'"
[[tool.cibuildwheel.overrides]]
select = "cp310-*"
container-engine = "docker; create_args: --privileged"
"""
)
)
@@ -55,21 +59,35 @@ def test_linux_container_split(tmp_path: Path, monkeypatch):
def before_alls(step):
return [options.build_options(c.identifier).before_all for c in step.platform_configs]
def container_engines(step):
return [options.build_options(c.identifier).container_engine for c in step.platform_configs]
pprint(build_steps)
default_container_engine = OCIContainerEngineConfig(name="docker")
assert build_steps[0].container_image == "normal_container_image"
assert identifiers(build_steps[0]) == [
"cp36-manylinux_x86_64",
"cp37-manylinux_x86_64",
"cp311-manylinux_x86_64",
"cp312-manylinux_x86_64",
]
assert before_alls(build_steps[0]) == ["", "", "", ""]
assert before_alls(build_steps[0]) == [""] * 3
assert container_engines(build_steps[0]) == [default_container_engine] * 3
assert build_steps[1].container_image == "other_container_image"
assert identifiers(build_steps[1]) == ["cp38-manylinux_x86_64", "cp310-manylinux_x86_64"]
assert before_alls(build_steps[1]) == ["", ""]
assert identifiers(build_steps[1]) == ["cp37-manylinux_x86_64", "cp38-manylinux_x86_64"]
assert before_alls(build_steps[1]) == [""] * 2
assert container_engines(build_steps[1]) == [default_container_engine] * 2
assert build_steps[2].container_image == "other_container_image"
assert identifiers(build_steps[2]) == ["cp39-manylinux_x86_64"]
assert before_alls(build_steps[2]) == ["echo 'a cp39-only command'"]
assert container_engines(build_steps[2]) == [default_container_engine]
assert build_steps[3].container_image == "other_container_image"
assert identifiers(build_steps[3]) == ["cp310-manylinux_x86_64"]
assert before_alls(build_steps[3]) == [""]
assert container_engines(build_steps[3]) == [
OCIContainerEngineConfig(name="docker", create_args=("--privileged",))
]
+8 -8
View File
@@ -340,7 +340,7 @@ def test_create_args_volume(tmp_path: Path, container_engine):
test_mount_dir.mkdir()
(test_mount_dir / "test_file.txt").write_text("1234")
container_engine = OCIContainerEngineConfig(
name="docker", create_args=[f"--volume={test_mount_dir}:/test_mount"]
name="docker", create_args=(f"--volume={test_mount_dir}:/test_mount",)
)
with OCIContainer(
@@ -356,37 +356,37 @@ def test_create_args_volume(tmp_path: Path, container_engine):
(
"docker",
"docker",
[],
(),
),
(
"docker;create_args:",
"docker",
[],
(),
),
(
"docker;create_args:--abc --def",
"docker",
["--abc", "--def"],
("--abc", "--def"),
),
(
"docker; create_args: --abc --def",
"docker",
["--abc", "--def"],
("--abc", "--def"),
),
(
"name:docker; create_args: --abc --def",
"docker",
["--abc", "--def"],
("--abc", "--def"),
),
(
'docker; create_args: --some-option="value with spaces"',
"docker",
["--some-option=value with spaces"],
("--some-option=value with spaces",),
),
(
'docker; create_args: --some-option="value; with; semicolons" --another-option',
"docker",
["--some-option=value; with; semicolons", "--another-option"],
("--some-option=value; with; semicolons", "--another-option"),
),
],
)
+42 -9
View File
@@ -206,49 +206,49 @@ def test_toml_environment_quoting(tmp_path: Path, toml_assignment, result_value)
(
'container-engine = "podman"',
"podman",
[],
(),
False,
),
(
'container-engine = {name = "podman"}',
"podman",
[],
(),
False,
),
(
'container-engine = "docker; create_args: --some-option"',
"docker",
["--some-option"],
("--some-option",),
False,
),
(
'container-engine = {name = "docker", create-args = ["--some-option"]}',
"docker",
["--some-option"],
("--some-option",),
False,
),
(
'container-engine = {name = "docker", create-args = ["--some-option", "value that contains spaces"]}',
"docker",
["--some-option", "value that contains spaces"],
("--some-option", "value that contains spaces"),
False,
),
(
'container-engine = {name = "docker", create-args = ["--some-option", "value;that;contains;semicolons"]}',
"docker",
["--some-option", "value;that;contains;semicolons"],
("--some-option", "value;that;contains;semicolons"),
False,
),
(
'container-engine = {name = "docker", disable-host-mount = true}',
"docker",
[],
(),
True,
),
(
'container-engine = {name = "docker", disable_host_mount = true}',
"docker",
[],
(),
True,
),
],
@@ -269,7 +269,7 @@ def test_container_engine_option(
)
options = Options(platform="linux", command_line_arguments=args, env={})
parsed_container_engine = options.globals.container_engine
parsed_container_engine = options.build_options(None).container_engine
assert parsed_container_engine.name == result_name
assert parsed_container_engine.create_args == result_create_args
@@ -415,3 +415,36 @@ def test_override_inherit_environment_with_references(tmp_path: Path):
) == {
"PATH": "/opt/local/bin:/opt/bin:/usr/bin:/bin",
}
@pytest.mark.parametrize(
("toml_assignment", "env", "expected_result"),
[
("", {}, False),
("free-threaded-support = true", {}, True),
("free-threaded-support = false", {}, False),
("", {"CIBW_FREE_THREADED_SUPPORT": "0"}, False),
("", {"CIBW_FREE_THREADED_SUPPORT": "1"}, True),
("free-threaded-support = false", {"CIBW_FREE_THREADED_SUPPORT": "1"}, True),
("free-threaded-support = true", {"CIBW_FREE_THREADED_SUPPORT": "0"}, False),
("free-threaded-support = true", {"CIBW_FREE_THREADED_SUPPORT": ""}, True),
("free-threaded-support = false", {"CIBW_FREE_THREADED_SUPPORT": ""}, False),
],
)
def test_free_threaded_support(
tmp_path: Path, toml_assignment: str, env: dict[str, str], expected_result: bool
):
args = CommandLineArguments.defaults()
args.package_dir = tmp_path
pyproject_toml: Path = tmp_path / "pyproject.toml"
pyproject_toml.write_text(
textwrap.dedent(
f"""\
[tool.cibuildwheel]
{toml_assignment}
"""
)
)
options = Options(platform="linux", command_line_arguments=args, env=env)
assert options.globals.build_selector.free_threaded_support is expected_result
+29 -1
View File
@@ -20,11 +20,39 @@ def test_validate_default_schema():
assert validator(example) is not None
def test_validate_bad_container_engine():
def test_validate_container_engine():
"""
This test checks container engine can be overridden - it used to be a
global option but is now a build option.
"""
example = tomllib.loads(
"""
[tool.cibuildwheel]
container-engine = "docker"
[tool.cibuildwheel.linux]
container-engine = "docker"
[[tool.cibuildwheel.overrides]]
select = "*_x86_64"
container-engine = "docker; create_args: --platform linux/arm64/v8"
"""
)
validator = validate_pyproject.api.Validator()
assert validator(example) is not None
@pytest.mark.parametrize("platform", ["macos", "windows"])
def test_validate_bad_container_engine(platform: str):
"""
container-engine is not a valid option for macos or windows
"""
example = tomllib.loads(
f"""
[tool.cibuildwheel.{platform}]
container-engine = "docker"
"""
)