Conversation
Use the new limited API and stable ABI build setup in Cython when producing wheels for Python 3.11 and newer. Older Python versions will still continue to use the Python specific versions as the Cython code uses APIs only available in the limited API since 3.11.
There was a problem hiding this comment.
Pull request overview
This PR implements the Python Limited API/Stable ABI for building wheels targeting Python 3.11 and newer. This allows a single wheel built with Python 3.11 to work across all Python 3.11+ versions, reducing the number of wheels that need to be built and distributed. The implementation requires Cython 3.2.1 for proper Limited API support and involves removing imports incompatible with the Limited API (like cpython.array), adding necessary C standard library headers for inline C code, and configuring the build system appropriately.
- Configured setup.py to use Py_LIMITED_API for Python 3.11+ and set up bdist_wheel options for Stable ABI
- Upgraded Cython dependency from 3.1.3 to 3.2.1 for better Limited API support
- Removed cpython.array import (incompatible with Limited API) and added standard C headers (errno.h, stdlib.h, string.h) to python_krb5.h for inline C code
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| setup.py | Adds Limited API configuration including Py_LIMITED_API macro definition, py_limited_api flag for extensions, and bdist_wheel options for cp311 stable ABI |
| pyproject.toml | Updates Cython build requirement from 3.1.3 to 3.2.1 for Limited API support |
| src/krb5/_principal.pyx | Removes cpython.array import that's incompatible with Limited API |
| src/krb5/python_krb5.h | Adds standard C library headers (errno.h, stdlib.h, string.h) needed by inline C code across multiple modules |
| setup.cfg | Bumps version from 0.8.0 to 0.9.0 |
| CHANGELOG.md | Documents the Stable ABI implementation and Cython version update |
| .github/workflows/ci.yml | Updates GitHub Actions versions and simplifies wheel build matrix to only build for Python 3.9-3.11 (relying on Stable ABI for 3.12+), changes macOS runners to macOS-15-intel and macOS-15 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Use the new limited API and stable ABI build setup in Cython when producing wheels for Python 3.11 and newer. Older Python versions will still continue to use the Python specific versions as the Cython code uses APIs only available in the limited API since 3.11.