From a1315b6669a5c14f12e8a97bf4921be3674b4aca Mon Sep 17 00:00:00 2001 From: Vilhjalmur Thorsteinsson Date: Tue, 14 Jul 2026 01:23:13 +0000 Subject: [PATCH] Tag CPython wheels as abi3 (cp310-abi3); release 3.7.1 The extension module has always been compiled against the stable ABI (py_limited_api in eparser_build.py produces _eparser.abi3.so), but bdist_wheel was never told, so the wheels were tagged cp3X-cp3X and only served the exact Python version they were built with - all other CPython versions silently fell back to sdist source builds. Pass the py_limited_api option to bdist_wheel via setup() (on CPython only; PyPy has no stable ABI), so a single cp310-abi3 wheel now serves all CPython versions >= 3.10. Verified locally: a wheel built under Python 3.13 installs and parses correctly on both 3.10 and 3.14. Also bump the extension's limited API target from cp39 to cp310 to match the supported floor. Co-Authored-By: Claude Fable 5 --- pyproject.toml | 2 +- setup.py | 12 ++++++++++++ src/reynir/eparser_build.py | 6 +++++- uv.lock | 2 +- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 8529fbc..2798f5b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "reynir" -version = "3.7.0" +version = "3.7.1" description = "A natural language parser for Icelandic" authors = [{ name = "Miðeind ehf.", email = "mideind@mideind.is" }] maintainers = [{ name = "Miðeind ehf.", email = "mideind@mideind.is" }] diff --git a/setup.py b/setup.py index 0b2804f..2edb156 100755 --- a/setup.py +++ b/setup.py @@ -4,11 +4,23 @@ All package metadata is defined in pyproject.toml. """ +import platform + from setuptools import setup +options = {} +if platform.python_implementation() == "CPython": + # Tag CPython wheels with the stable ABI (e.g. cp310-abi3), so that a + # single wheel serves all CPython versions >= 3.10. The extension + # module itself is compiled with Py_LIMITED_API via the py_limited_api + # flag in eparser_build.py; this option makes the *wheel tag* reflect + # that. Not applicable to PyPy, which has no stable ABI. + options = {"bdist_wheel": {"py_limited_api": "cp310"}} + # The cffi_modules and zip_safe settings are not yet supported in pyproject.toml # and must be defined here. setup( zip_safe=True, cffi_modules=["src/reynir/eparser_build.py:ffibuilder"], + options=options, ) diff --git a/src/reynir/eparser_build.py b/src/reynir/eparser_build.py index 9d976da..9c96a3d 100644 --- a/src/reynir/eparser_build.py +++ b/src/reynir/eparser_build.py @@ -152,7 +152,11 @@ # Use the Python stable ABI (abi3) for CPython, allowing a single wheel # to work across multiple Python versions (3.9+). PyPy doesn't support abi3. -py_limited_api = "cp39" if IMPLEMENTATION == "CPython" else False +# Compile the extension against the stable ABI (Py_LIMITED_API) on +# CPython, producing an _eparser.abi3.so module usable on any CPython +# version >= 3.10. The matching cp310-abi3 wheel tag is set via the +# bdist_wheel py_limited_api option in setup.py. +py_limited_api = "cp310" if IMPLEMENTATION == "CPython" else False ffibuilder.cdef(declarations + callbacks) diff --git a/uv.lock b/uv.lock index f497e23..d1fdaad 100644 --- a/uv.lock +++ b/uv.lock @@ -409,7 +409,7 @@ wheels = [ [[package]] name = "reynir" -version = "3.7.0" +version = "3.7.1" source = { editable = "." } dependencies = [ { name = "cffi" },