From ae28dd2e3b14a490fa995325b1e5d09bbfe98066 Mon Sep 17 00:00:00 2001 From: Himanshu Agrawal Date: Fri, 12 Jun 2026 02:03:50 +0530 Subject: [PATCH] docs: document py-limited-api wheel tagging --- docs/userguide/ext_modules.rst | 21 +++++++++++++++++++++ newsfragments/4741.doc.rst | 2 ++ 2 files changed, 23 insertions(+) create mode 100644 newsfragments/4741.doc.rst diff --git a/docs/userguide/ext_modules.rst b/docs/userguide/ext_modules.rst index 4abc3dcd04..3e751a630c 100644 --- a/docs/userguide/ext_modules.rst +++ b/docs/userguide/ext_modules.rst @@ -63,6 +63,27 @@ Optionally any other parameter of :class:`setuptools.Extension` can be defined in the configuration file (but in the case of ``pyproject.toml`` they must be written using :wiki:`kebab-case` convention). +.. note:: + ``Extension(..., py_limited_api=True)`` and wheel tagging are configured + separately. If the built wheel should be tagged with ``abi3`` for CPython's + limited API, configure the ``bdist_wheel`` ``py_limited_api`` option with + the minimum supported CPython tag, such as ``cp311``: + + .. tab:: setup.cfg + + .. code-block:: ini + + [bdist_wheel] + py-limited-api = cp311 + + .. tab:: setup.py + + .. code-block:: python + + setup( + options={"bdist_wheel": {"py_limited_api": "cp311"}}, + ) + .. seealso:: You can find more information on the `Python docs about C/C++ extensions`_. Alternatively, you might also be interested in learning about `Cython`_. diff --git a/newsfragments/4741.doc.rst b/newsfragments/4741.doc.rst new file mode 100644 index 0000000000..32729d1592 --- /dev/null +++ b/newsfragments/4741.doc.rst @@ -0,0 +1,2 @@ +Documented how ``bdist_wheel``'s ``py_limited_api`` option controls +``abi3`` wheel tagging for extension modules -- by :user:`Himanshuagrawal4`