chore: build wheel with limited api#32
Merged
lexdene merged 2 commits intodouban:masterfrom Dec 9, 2025
Merged
Conversation
Contributor
Author
|
fix #25 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Step 1: Standard bdist wheel command
Running the standard bdist_wheel command:
produces a platform-specific wheel with a filename like:
Attempting to install this wheel on a different Python minor version, such as Python 3.10, results in a platform compatibility error:
Step 2: Adding limited api Flag
Adding the
--py-limited-apiparameter to the bdist_wheel command:produces an ABI3 wheel package with a more compatible filename:
However, the name of the compiled shared object (.so) file inside the wheel package is still incorrect:
While the wheel installs successfully on Python 3.10,
running tests raises an ImportError because the module cannot be found under the expected ABI-stable name:
Step 3: Configuring Limited API in setup.py
The correct solution is to explicitly define the Limited API settings within the Extension configuration in setup.py:
This configuration ensures that both the wheel package name and the internal shared object file name are correct for ABI3 compatibility:
Correct Wheel Name:
Correct .so File Name:
This wheel can now be installed and tested successfully across the specified range of target Python versions, from Python 3.9 to Python 3.14.