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" },