Skip to content

Commit b329d16

Browse files
Merge pull request #65 from mideind/fix/abi3-wheel-tag
Tag CPython wheels as abi3 (cp310-abi3); release 3.7.1
2 parents 1e5cc4e + a1315b6 commit b329d16

4 files changed

Lines changed: 19 additions & 3 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "reynir"
7-
version = "3.7.0"
7+
version = "3.7.1"
88
description = "A natural language parser for Icelandic"
99
authors = [{ name = "Miðeind ehf.", email = "mideind@mideind.is" }]
1010
maintainers = [{ name = "Miðeind ehf.", email = "mideind@mideind.is" }]

setup.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,23 @@
44
All package metadata is defined in pyproject.toml.
55
"""
66

7+
import platform
8+
79
from setuptools import setup
810

11+
options = {}
12+
if platform.python_implementation() == "CPython":
13+
# Tag CPython wheels with the stable ABI (e.g. cp310-abi3), so that a
14+
# single wheel serves all CPython versions >= 3.10. The extension
15+
# module itself is compiled with Py_LIMITED_API via the py_limited_api
16+
# flag in eparser_build.py; this option makes the *wheel tag* reflect
17+
# that. Not applicable to PyPy, which has no stable ABI.
18+
options = {"bdist_wheel": {"py_limited_api": "cp310"}}
19+
920
# The cffi_modules and zip_safe settings are not yet supported in pyproject.toml
1021
# and must be defined here.
1122
setup(
1223
zip_safe=True,
1324
cffi_modules=["src/reynir/eparser_build.py:ffibuilder"],
25+
options=options,
1426
)

src/reynir/eparser_build.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,11 @@
152152

153153
# Use the Python stable ABI (abi3) for CPython, allowing a single wheel
154154
# to work across multiple Python versions (3.9+). PyPy doesn't support abi3.
155-
py_limited_api = "cp39" if IMPLEMENTATION == "CPython" else False
155+
# Compile the extension against the stable ABI (Py_LIMITED_API) on
156+
# CPython, producing an _eparser.abi3.so module usable on any CPython
157+
# version >= 3.10. The matching cp310-abi3 wheel tag is set via the
158+
# bdist_wheel py_limited_api option in setup.py.
159+
py_limited_api = "cp310" if IMPLEMENTATION == "CPython" else False
156160

157161
ffibuilder.cdef(declarations + callbacks)
158162

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)