From eec41b9679eb0fa6c6473478e9e3df2c75584269 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Thu, 6 Nov 2025 07:49:29 +0100 Subject: [PATCH 1/5] Build for limited API only on supported interpreters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pass the limited API options only when building for non-free-threading CPython versions. Passing the flags on other interpreters (such as PyPy or GraalPy) or free-threading CPython versions results in build failures due to the limited API not being supported. While this package doesn't support free-threading Python right now, I think it makes sense to make the condition future-proof while I'm already fixing PyPy builds. See also https://github.com/cython/cython/issues/7279 Signed-off-by: Michał Górny --- setup.py | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/setup.py b/setup.py index 2f6614b..e90f6aa 100644 --- a/setup.py +++ b/setup.py @@ -1,3 +1,6 @@ +import sys +import sysconfig + from setuptools import Extension, setup from Cython.Build import cythonize @@ -11,17 +14,27 @@ # 0x030B0000 - Python 3.11 - support typed memoryviews. # 0x030C0000 - Python 3.12 - support vectorcall (performance improvement). +py_limited_api_kwargs = {} +if sys.implementation.name == "cpython" and not sysconfig.get_config_var( + "Py_GIL_DISABLED" +): + py_limited_api_kwargs = { + "define_macros": [ + # For now we are at python 3.8 as we still support 3.10. + ("Py_LIMITED_API", 0x03080000), + ], + "py_limited_api": True, + } + setup( - ext_modules=cythonize([ - Extension( - name="raiser", - sources=["cython_test_exception_raiser/raiser.pyx"], - define_macros=[ - # For now we are at python 3.8 as we still support 3.10. - ("Py_LIMITED_API", 0x03080000), - ], - py_limited_api=True - ), - ]), + ext_modules=cythonize( + [ + Extension( + name="raiser", + sources=["cython_test_exception_raiser/raiser.pyx"], + **py_limited_api_kwargs + ), + ] + ), options={"bdist_wheel": {"py_limited_api": "cp38"}}, ) From 8bb6a2b61e90fe5ca0e86038c6cc566b279f013f Mon Sep 17 00:00:00 2001 From: Adi Roiban Date: Thu, 6 Nov 2025 08:20:03 +0000 Subject: [PATCH 2/5] Enable free threading builds --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 3769af4..7d58a54 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,4 +12,4 @@ build-backend = "setuptools.build_meta" enable = ["all"] # See https://cibuildwheel.pypa.io/en/stable/options/#build-skip # Not sure why it was failing on PyPy 3.11. -build = "cp38-* pp310-*" +build = "cp38-* pp310-* cp313t-* cp314t-*" From b0a0f0bff4097d2e36a57a2233c07e182252a3a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Thu, 6 Nov 2025 14:03:05 +0100 Subject: [PATCH 3/5] Guard `bdist_wheel` options as well MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michał Górny --- setup.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index e90f6aa..647a55b 100644 --- a/setup.py +++ b/setup.py @@ -15,6 +15,7 @@ # 0x030C0000 - Python 3.12 - support vectorcall (performance improvement). py_limited_api_kwargs = {} +bdist_wheel_kwargs = {} if sys.implementation.name == "cpython" and not sysconfig.get_config_var( "Py_GIL_DISABLED" ): @@ -25,6 +26,7 @@ ], "py_limited_api": True, } + bdist_wheel_kwargs = {"py_limited_api": "cp38"} setup( ext_modules=cythonize( @@ -36,5 +38,5 @@ ), ] ), - options={"bdist_wheel": {"py_limited_api": "cp38"}}, + options={"bdist_wheel": {**bdist_wheel_kwargs}}, ) From 9e94ba161ce885a5b587442812da9fcb843c2423 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Thu, 6 Nov 2025 14:03:29 +0100 Subject: [PATCH 4/5] Try building a pp311 wheel MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michał Górny --- pyproject.toml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 7d58a54..f740060 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,5 +11,4 @@ build-backend = "setuptools.build_meta" # configuration below. enable = ["all"] # See https://cibuildwheel.pypa.io/en/stable/options/#build-skip -# Not sure why it was failing on PyPy 3.11. -build = "cp38-* pp310-* cp313t-* cp314t-*" +build = "cp38-* pp310-* pp311-* cp313t-* cp314t-*" From 15dcc50be4d63faaf147e51fd285ebbf5445642f Mon Sep 17 00:00:00 2001 From: Adi Roiban Date: Thu, 6 Nov 2025 16:41:22 +0000 Subject: [PATCH 5/5] Update CHANGELOG.rst --- CHANGELOG.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 4bb59b9..d72cd5c 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -2,6 +2,13 @@ Changelog ========= +Unreleased +---------- + +- Enable thread-free wheels for Python 3.13 and 3.14. +- Enable PYPY 3.11 wheels. + + 2025.11.0 (2025-11-02) ----------------------