port-to-python-limited-api
Port a hand-written C/C++ CPython extension from the version-specific C API to the Limited API (Py_LIMITED_API) so one stable-ABI abi3 wheel loads on every later Python instead of one per version — and optionally target Python 3.15 abi3t (PEP 803 + PEP 793 PyModExport) for a single wheel across GIL-enabled and free-threaded builds. Covers the usual first step of converting static PyTypeObject types to heap types (PyType_FromSpec / PyType_Slot), module state, multi-phase init, API substitutions, and the build flags / abi3 / abi3.abi3t wheel tags for meson-python, scikit-build-core, maturin, and setuptools. Use to adopt the limited API / stable ABI / abi3 / abi3t, stop rebuilding a C extension per Python version, or convert static types to heap types. Not for pybind11/nanobind (see pybind11-to-nanobind) or the PyTorch C++ ABI (see port-to-torch-stable-abi).
Pinned to revision 0c51c24122b3, so it is the text this page describes rather than whatever the author pushed since.
Files
- skills/port-to-python-limited-api/SKILL.md
- skills/port-to-python-limited-api/AGENTS.md
- skills/port-to-python-limited-api/README.md
- skills/port-to-python-limited-api/reference/api-substitutions.md
- skills/port-to-python-limited-api/reference/background.md
- skills/port-to-python-limited-api/reference/build-systems.md
- skills/port-to-python-limited-api/reference/heap-types.md
- skills/port-to-python-limited-api/reference/module-init.md
- skills/port-to-python-limited-api/reference/refleak-detection.md
Every link opens the file at its source, pinned to the revision this page describes.