Skip to content

Commit

Permalink
chore: drop deprecated options
Browse files Browse the repository at this point in the history
  • Loading branch information
mayeut committed Nov 24, 2024
1 parent 72e46a4 commit 4097d72
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 104 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ jobs:
env:
CIBW_ARCHS_MACOS: x86_64 universal2 arm64
CIBW_BUILD_FRONTEND: 'build[uv]'
CIBW_FREE_THREADED_SUPPORT: 1
CIBW_PRERELEASE_PYTHONS: 1
CIBW_ENABLE: "cpython-prerelease cpython-freethreading pypy"

- name: Run a sample build (GitHub Action, only)
uses: ./
Expand Down
6 changes: 0 additions & 6 deletions bin/generate_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,6 @@
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)
deprecated: Use the `enable` option instead.
manylinux-aarch64-image:
type: string
description: Specify alternative manylinux / musllinux container images
Expand Down Expand Up @@ -277,7 +272,6 @@
del non_global_options["build"]
del non_global_options["skip"]
del non_global_options["test-skip"]
del non_global_options["free-threaded-support"]
del non_global_options["enable"]

overrides["items"]["properties"]["select"]["oneOf"] = string_array
Expand Down
6 changes: 0 additions & 6 deletions cibuildwheel/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,6 @@ def main_inner(global_options: GlobalOptions) -> None:
help="Do not report an error code if the build does not match any wheels.",
)

parser.add_argument(
"--prerelease-pythons",
action="store_true",
help="Enable pre-release Python versions if available.",
)

parser.add_argument(
"--debug-traceback",
action="store_true",
Expand Down
40 changes: 1 addition & 39 deletions cibuildwheel/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
EnableGroups,
TestSelector,
format_safe,
read_python_configs,
resources_dir,
selector_matches,
strtobool,
Expand All @@ -50,7 +49,6 @@ class CommandLineArguments:
package_dir: Path
print_build_identifiers: bool
allow_empty: bool
prerelease_pythons: bool
debug_traceback: bool

@staticmethod
Expand All @@ -63,7 +61,6 @@ def defaults() -> CommandLineArguments:
config_file="",
output_dir=Path("wheelhouse"),
package_dir=Path("."),
prerelease_pythons=False,
print_build_identifiers=False,
debug_traceback=False,
)
Expand Down Expand Up @@ -618,27 +615,6 @@ def globals(self) -> GlobalOptions:
)
enable = {EnableGroups(group) for group in enable_groups.split()}

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")
)

if free_threaded_support or prerelease_pythons:
msg = (
"free-threaded-support and prerelease-pythons should be specified by enable instead"
)
if enable:
raise OptionsReaderError(msg)
log.warning(msg)

if free_threaded_support:
enable.add(EnableGroups.CPythonFreeThreading)
if prerelease_pythons:
enable.add(EnableGroups.CPythonPrerelease)

# This is not supported in tool.cibuildwheel, as it comes from a standard location.
# Passing this in as an environment variable will override pyproject.toml, setup.cfg, or setup.py
requires_python_str: str | None = (
Expand All @@ -660,24 +636,10 @@ def globals(self) -> GlobalOptions:
build_config=build_config,
skip_config=skip_config,
requires_python=requires_python,
enable=frozenset(
enable | {EnableGroups.PyPy}
), # For backwards compatibility, we are adding PyPy for now
enable=frozenset(enable),
)
test_selector = TestSelector(skip_config=test_skip)

all_configs = read_python_configs(self.platform)
all_pypy_ids = {
config["identifier"] for config in all_configs if config["identifier"].startswith("pp")
}
if (
not self._defaults
and EnableGroups.PyPy not in enable
and any(build_selector(build_id) for build_id in all_pypy_ids)
):
msg = "PyPy builds will be disabled by default in version 3. Enabling PyPy builds should be specified by enable"
log.warning(msg)

return GlobalOptions(
package_dir=package_dir,
output_dir=output_dir,
Expand Down
7 changes: 0 additions & 7 deletions cibuildwheel/resources/cibuildwheel.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -284,13 +284,6 @@
],
"title": "CIBW_ENVIRONMENT_PASS"
},
"free-threaded-support": {
"type": "boolean",
"default": false,
"description": "The project supports free-threaded builds of Python (PEP703)",
"deprecated": "Use the `enable` option instead.",
"title": "CIBW_FREE_THREADED_SUPPORT"
},
"manylinux-aarch64-image": {
"type": "string",
"description": "Specify alternative manylinux / musllinux container images",
Expand Down
1 change: 0 additions & 1 deletion cibuildwheel/resources/defaults.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
build = "*"
skip = ""
test-skip = ""
free-threaded-support = false
enable = []

archs = ["auto"]
Expand Down
13 changes: 5 additions & 8 deletions docs/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -566,18 +566,15 @@ for new users, but can be added to the selectors available here. The allowed
values are:


- `cypython-prerelease`: Enables beta versions of Pythons if any are available
(May-July, approximately). For backward compatibility, `CIBW_PRERELEASE_PYTHONS`
is also supported until cibuildwheel 3.
- `cpython-prerelease`: Enables beta versions of Pythons if any are available
(May-July, approximately).
- `cpython-freethreading`: [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. This will enable building these wheels while they are experimental.
The build identifiers for those variants have a `t` suffix in their
`python_tag` (e.g. `cp313t-manylinux_x86_64`). For backward compatibility,
`CIBW_FREE_THREADED_SUPPORT` is also supported until cibuildwheel 3.
- `pypy`: Enable PyPy. For backward compatibility, this is always enabled until
cibuildwheel 3 is released.
`python_tag` (e.g. `cp313t-manylinux_x86_64`).
- `pypy`: Enable PyPy.


!!! caution
Expand All @@ -591,7 +588,7 @@ values are:
!!! note
Free threading is experimental: [What’s New In Python 3.13](https://docs.python.org/3.13/whatsnew/3.13.html#free-threaded-cpython)

Default: empty (`pypy` is always injected).
Default: empty.

This option doesn't support overrides or platform specific variants; it is
intended as a way to acknowledge that a project is aware that these extra
Expand Down
9 changes: 4 additions & 5 deletions test/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ def cibuildwheel_get_build_identifiers(
for the current platform.
"""
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")
env["CIBW_ENABLE"] = "cpython-freethreading pypy"
if prerelease_pythons:
env["CIBW_ENABLE"] += " cpython-prerelease"

cmd_output = subprocess.run(
cmd,
Expand Down Expand Up @@ -115,7 +115,7 @@ def cibuildwheel_run(

_update_pip_cache_dir(env)

env.setdefault("CIBW_FREE_THREADED_SUPPORT", "1")
env["CIBW_ENABLE"] = "cpython-prerelease cpython-freethreading pypy"

if single_python:
env["CIBW_BUILD"] = "cp{}{}-*".format(*SINGLE_PYTHON_VERSION)
Expand All @@ -126,7 +126,6 @@ def cibuildwheel_run(
sys.executable,
"-m",
"cibuildwheel",
"--prerelease-pythons",
"--output-dir",
str(output_dir or tmp_output_dir),
str(package_dir),
Expand Down
31 changes: 9 additions & 22 deletions unit_test/option_prepare_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,8 @@
from cibuildwheel.__main__ import main
from cibuildwheel.oci_container import OCIPlatform

ALL_IDS = {
"cp36",
"cp37",
"cp38",
"cp39",
"cp310",
"cp311",
"cp312",
"cp313",
"pp37",
"pp38",
"pp39",
"pp310",
}
DEFAULT_IDS = {"cp36", "cp37", "cp38", "cp39", "cp310", "cp311", "cp312", "cp313"}
ALL_IDS = DEFAULT_IDS | {"cp313t", "pp37", "pp38", "pp39", "pp310"}


@pytest.fixture
Expand Down Expand Up @@ -77,33 +65,31 @@ def test_build_default_launches(monkeypatch):
assert kwargs["container"]["oci_platform"] == OCIPlatform.AMD64

identifiers = {x.identifier for x in kwargs["platform_configs"]}
assert identifiers == {f"{x}-manylinux_x86_64" for x in ALL_IDS}
assert identifiers == {f"{x}-manylinux_x86_64" for x in DEFAULT_IDS}

kwargs = build_in_container.call_args_list[1][1]
assert "quay.io/pypa/manylinux2014_i686" in kwargs["container"]["image"]
assert kwargs["container"]["cwd"] == PurePosixPath("/project")
assert kwargs["container"]["oci_platform"] == OCIPlatform.i386

identifiers = {x.identifier for x in kwargs["platform_configs"]}
assert identifiers == {f"{x}-manylinux_i686" for x in ALL_IDS}
assert identifiers == {f"{x}-manylinux_i686" for x in DEFAULT_IDS}

kwargs = build_in_container.call_args_list[2][1]
assert "quay.io/pypa/musllinux_1_2_x86_64" in kwargs["container"]["image"]
assert kwargs["container"]["cwd"] == PurePosixPath("/project")
assert kwargs["container"]["oci_platform"] == OCIPlatform.AMD64

identifiers = {x.identifier for x in kwargs["platform_configs"]}
assert identifiers == {
f"{x}-musllinux_x86_64" for x in ALL_IDS for x in ALL_IDS if "pp" not in x
}
assert identifiers == {f"{x}-musllinux_x86_64" for x in DEFAULT_IDS}

kwargs = build_in_container.call_args_list[3][1]
assert "quay.io/pypa/musllinux_1_2_i686" in kwargs["container"]["image"]
assert kwargs["container"]["cwd"] == PurePosixPath("/project")
assert kwargs["container"]["oci_platform"] == OCIPlatform.i386

identifiers = {x.identifier for x in kwargs["platform_configs"]}
assert identifiers == {f"{x}-musllinux_i686" for x in ALL_IDS if "pp" not in x}
assert identifiers == {f"{x}-musllinux_i686" for x in DEFAULT_IDS}


@pytest.mark.usefixtures("mock_build_container")
Expand All @@ -117,6 +103,7 @@ def test_build_with_override_launches(monkeypatch, tmp_path):
[tool.cibuildwheel]
manylinux-x86_64-image = "manylinux_2_28"
musllinux-x86_64-image = "musllinux_1_2"
enable = ["pypy", "cpython-freethreading"]
# Before Python 3.10, use manylinux2014, musllinux_1_1
[[tool.cibuildwheel.overrides]]
Expand Down Expand Up @@ -158,7 +145,7 @@ def test_build_with_override_launches(monkeypatch, tmp_path):
assert identifiers == {
f"{x}-manylinux_x86_64"
for x in ALL_IDS
- {"cp36", "cp310", "cp311", "cp312", "cp313", "pp37", "pp38", "pp39", "pp310"}
- {"cp36", "cp310", "cp311", "cp312", "cp313", "cp313t", "pp37", "pp38", "pp39", "pp310"}
}
assert kwargs["options"].build_options("cp37-manylinux_x86_64").before_all == ""

Expand All @@ -169,7 +156,7 @@ def test_build_with_override_launches(monkeypatch, tmp_path):
identifiers = {x.identifier for x in kwargs["platform_configs"]}
assert identifiers == {
f"{x}-manylinux_x86_64"
for x in ["cp310", "cp311", "cp312", "cp313", "pp37", "pp38", "pp39", "pp310"]
for x in ["cp310", "cp311", "cp312", "cp313", "cp313t", "pp37", "pp38", "pp39", "pp310"]
}

kwargs = build_in_container.call_args_list[3][1]
Expand Down
16 changes: 8 additions & 8 deletions unit_test/options_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,14 +429,14 @@ def test_override_inherit_environment_with_references(tmp_path: Path) -> None:
("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),
("enable = ['cpython-freethreading']", {}, True),
("enable = []", {}, False),
("", {"CIBW_ENABLE": "pypy"}, False),
("", {"CIBW_ENABLE": "cpython-freethreading"}, True),
("enable = []", {"CIBW_ENABLE": "cpython-freethreading"}, True),
("enable = ['cpython-freethreading']", {"CIBW_ENABLE": "pypy"}, True),
("enable = ['cpython-freethreading']", {"CIBW_ENABLE": ""}, True),
("enable = []", {"CIBW_ENABLE": ""}, False),
],
)
def test_free_threaded_support(
Expand Down

0 comments on commit 4097d72

Please sign in to comment.