Skip to content

Commit 9549af3

Browse files
committed
deprecation: cp313t
Free-Threading Python 3.13 was experimental. Now that Python 3.14 has been released with explicit support, we can schedule removal of Python 3.13 free-threading.
1 parent 6f8121f commit 9549af3

6 files changed

Lines changed: 79 additions & 10 deletions

File tree

cibuildwheel/__main__.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -432,11 +432,7 @@ def print_preamble(platform: str, options: Options, identifiers: Sequence[str])
432432
def detect_errors(*, options: Options, identifiers: Iterable[str]) -> Generator[str, None, None]:
433433
# Check for deprecated CIBW_FREE_THREADED_SUPPORT environment variable
434434
if "CIBW_FREE_THREADED_SUPPORT" in os.environ:
435-
yield (
436-
"CIBW_FREE_THREADED_SUPPORT environment variable is no longer supported. "
437-
'Use tool.cibuildwheel.enable = ["cpython-freethreading"] in pyproject.toml '
438-
"or set CIBW_ENABLE=cpython-freethreading instead."
439-
)
435+
yield "CIBW_FREE_THREADED_SUPPORT environment variable is no longer supported."
440436

441437
# Deprecated {python} and {pip}
442438
for option_name in ["test_command", "before_build"]:
@@ -463,6 +459,13 @@ def detect_warnings(*, options: Options) -> Generator[str, None, None]:
463459
build_selector = options.globals.build_selector
464460
test_selector = options.globals.test_selector
465461

462+
if EnableGroup.CPythonFreeThreading in build_selector.enable:
463+
yield (
464+
"'cpython-freethreading' enable is deprecated and will be removed in a future version. "
465+
"It should be removed from tool.cibuildwheel.enable in pyproject.toml "
466+
"or CIBW_ENABLE environment variable."
467+
)
468+
466469
all_valid_identifiers = [
467470
config.identifier
468471
for module in ALL_PLATFORM_MODULES.values()

cibuildwheel/options.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -686,6 +686,8 @@ def globals(self) -> GlobalOptions:
686686
skip_config = ""
687687
architectures = Architecture.all_archs(self.platform)
688688
enable |= EnableGroup.all_groups()
689+
if args.only.startswith("cp313t-"):
690+
enable.add(EnableGroup.CPythonFreeThreading)
689691

690692
build_selector = BuildSelector(
691693
build_config=build_config,

cibuildwheel/selector.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class EnableGroup(StrEnum):
3838

3939
@classmethod
4040
def all_groups(cls) -> frozenset["EnableGroup"]:
41-
return frozenset(cls)
41+
return frozenset(set(cls) - {cls.CPythonFreeThreading})
4242

4343
@classmethod
4444
def parse_option_value(cls, value: str) -> frozenset["EnableGroup"]:

test/test_abi_variants.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def test_abi3(tmp_path):
4141
add_env={
4242
# free_threaded, GraalPy, and PyPy do not have a Py_LIMITED_API equivalent, just build one of those
4343
# also limit the number of builds for test performance reasons
44-
"CIBW_BUILD": "cp39-* cp310-* pp310-* gp312_250-* cp312-* cp313t-*",
44+
"CIBW_BUILD": "cp39-* cp310-* pp310-* gp312_250-* cp312-* cp314t-*",
4545
"CIBW_ENABLE": "all",
4646
},
4747
)
@@ -62,7 +62,7 @@ def test_abi3(tmp_path):
6262
python_abi_tags=[
6363
"cp39-cp39",
6464
"cp310-abi3", # <-- ABI3, works with 3.10 and 3.12
65-
"cp313-cp313t",
65+
"cp314-cp314t",
6666
"pp310-pypy310_pp73",
6767
"graalpy312-graalpy250_312_native",
6868
],
@@ -189,7 +189,7 @@ def test_abi_none(tmp_path, capfd):
189189
"CIBW_TEST_REQUIRES": "pytest",
190190
"CIBW_TEST_COMMAND": f"{utils.invoke_pytest()} {{project}}/test",
191191
# limit the number of builds for test performance reasons
192-
"CIBW_BUILD": "cp38-* cp{}{}-* cp313t-* pp310-*".format(*utils.SINGLE_PYTHON_VERSION),
192+
"CIBW_BUILD": "cp38-* cp{}{}-* cp314t-* pp310-*".format(*utils.SINGLE_PYTHON_VERSION),
193193
"CIBW_ENABLE": "all",
194194
},
195195
)

unit_test/get_platform_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def test_arm(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
7171

7272
def test_env_set(tmp_path: Path) -> None:
7373
environment = {"VSCMD_ARG_TGT_ARCH": "x64"}
74-
configuration = PythonConfiguration(version="irrelevant", identifier="cp313t-win32", url=None)
74+
configuration = PythonConfiguration(version="irrelevant", identifier="cp314t-win32", url=None)
7575

7676
with pytest.raises(FatalError, match="VSCMD_ARG_TGT_ARCH"):
7777
setup_setuptools_cross_compile(tmp_path, configuration, tmp_path, environment)

unit_test/main_tests/main_options_test.py

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,70 @@ def test_empty_selector(monkeypatch):
141141
assert e.value.code == 3
142142

143143

144+
@pytest.mark.usefixtures("platform", "intercepted_build_args")
145+
def test_cp313t_warning1(monkeypatch, capsys):
146+
monkeypatch.setenv("CIBW_ENABLE", "cpython-freethreading")
147+
148+
main()
149+
150+
_, err = capsys.readouterr()
151+
print(err)
152+
assert "'cpython-freethreading' enable is deprecated" in err
153+
154+
155+
@pytest.mark.usefixtures("platform", "intercepted_build_args")
156+
def test_cp313t_warning2(monkeypatch, capsys, tmp_path):
157+
local_path = tmp_path / "tmp_project"
158+
os.mkdir(local_path) # noqa:PTH102 Path.mkdir has been monkeypatched already
159+
local_path.joinpath("setup.py").touch()
160+
161+
monkeypatch.setattr(
162+
sys, "argv", ["cibuildwheel", "--only", "cp313t-manylinux_x86_64", str(local_path)]
163+
)
164+
monkeypatch.setenv("CIBW_ENABLE", "cpython-freethreading")
165+
166+
main()
167+
168+
_, err = capsys.readouterr()
169+
print(err)
170+
assert "'cpython-freethreading' enable is deprecated" in err
171+
172+
173+
@pytest.mark.usefixtures("platform", "intercepted_build_args")
174+
def test_cp313t_warning3(monkeypatch, capsys, tmp_path):
175+
local_path = tmp_path / "tmp_project"
176+
os.mkdir(local_path) # noqa:PTH102 Path.mkdir has been monkeypatched already
177+
local_path.joinpath("setup.py").touch()
178+
179+
monkeypatch.setattr(
180+
sys, "argv", ["cibuildwheel", "--only", "cp313t-manylinux_x86_64", str(local_path)]
181+
)
182+
183+
main()
184+
185+
_, err = capsys.readouterr()
186+
print(err)
187+
assert "'cpython-freethreading' enable is deprecated" in err
188+
189+
190+
@pytest.mark.usefixtures("platform", "intercepted_build_args")
191+
def test_cp313t_warning4(monkeypatch, capsys, tmp_path):
192+
local_path = tmp_path / "tmp_project"
193+
os.mkdir(local_path) # noqa:PTH102 Path.mkdir has been monkeypatched already
194+
local_path.joinpath("setup.py").touch()
195+
196+
monkeypatch.setattr(
197+
sys, "argv", ["cibuildwheel", "--only", "cp313t-manylinux_x86_64", str(local_path)]
198+
)
199+
monkeypatch.setenv("CIBW_ENABLE", "all")
200+
201+
main()
202+
203+
_, err = capsys.readouterr()
204+
print(err)
205+
assert "'cpython-freethreading' enable is deprecated" in err
206+
207+
144208
@pytest.mark.parametrize(
145209
("architecture", "image", "full_image"),
146210
[

0 commit comments

Comments
 (0)