From 31e6440f95f31a038ac496a95d41d58cd6e1e351 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Wed, 8 Oct 2025 14:23:19 +0200 Subject: [PATCH] feat: build abi3 wheels --- .github/workflows/setup.yml | 1 + setup.py | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/.github/workflows/setup.yml b/.github/workflows/setup.yml index abe182c..3964dc9 100644 --- a/.github/workflows/setup.yml +++ b/.github/workflows/setup.yml @@ -89,6 +89,7 @@ jobs: path: dist merge-multiple: true - run: uvx twine check dist/*.whl + - run: uvx abi3audit dist/*abi3*.whl publish: if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') diff --git a/setup.py b/setup.py index f5557cc..aff0187 100755 --- a/setup.py +++ b/setup.py @@ -1,14 +1,28 @@ #!/usr/bin/env python """Setup for the siphashc module.""" +import sysconfig + from setuptools import Extension, setup +define_macros = [("Py_LIMITED_API", "0x030A0000")] +bdist_options = {"py_limited_api": "cp310"} + +# Free-threaded Python is not compatible with ABI3, see +# https://github.com/python/cpython/issues/111506 +if sysconfig.get_config_var("Py_GIL_DISABLED"): + define_macros = [] + bdist_options = {} + setup( ext_modules=[ Extension( name="siphashc", sources=["siphashc.c", "siphash/siphash.c"], language="c", + define_macros=define_macros, + py_limited_api=True, ), ], + options={"bdist_wheel": bdist_options}, )