Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building abi3 wheel only #59

Closed
laggykiller opened this issue Mar 1, 2024 · 3 comments
Closed

Building abi3 wheel only #59

laggykiller opened this issue Mar 1, 2024 · 3 comments

Comments

@laggykiller
Copy link
Contributor

laggykiller commented Mar 1, 2024

According to cffi documentation, code produced by cffi >= 1.8 conatins #define Py_LIMITED_API, which makes the wheel abi3 compatible. This means we can just produce one abi3 wheel on minimum supported python version, and that wheel should work on all subsequent python 3 versions.

This reduces number of wheels needed to be built and uploaded to pypi, as well as eliminating the need to rebuild when python releases new versions.

All that is required in this project is to create setup.cfg and add:

[bdist_wheel]
py_limited_api = cp35

In theory the wheel produced should run in python 3.2, but the python code uses enum, which is first introduced in python 3.4. I could not install python 3.4, but I managed to verify that the wheel could be installed in python 3.5 on Linux, and passes all tests with pytest.

Github action building abi3 wheels with artifact: https://github.com/laggykiller/pywebp/actions/runs/8115496397

I have also added an action that run abi3audit, ensuring that the wheels built are abi3 compatible.

If you are interested, I can submit a PR, along with the PR mentioned in #58

@anibali
Copy link
Owner

anibali commented Mar 1, 2024

That is a really awesome find, thank you for bringing it to my attention. It should make all of the builds much more manageable, and I can use it in other projects too.

I would absolutely appreciate a PR, with the following alterations:

  1. Place the py_limited_api option in setup.py to avoid creating setup.cfg. EDIT: See Document py-limited-api option pypa/wheel#583
  2. Keep the minimum Python version at 3.8 (it is almost 5 years old at this point, and the most recent version that is not yet EOL)
  3. Bump the minimum required CFFI to 1.12

@laggykiller
Copy link
Contributor Author

Place the py_limited_api option in setup.py to avoid creating setup.cfg

This took me so long to find, it was poorly documented: pypa/wheel#583

I have moved the setting into setup.py

Keep the minimum Python version at 3.8

I was thinking of marking the absolute minimum required python version, but sure

Bump the minimum required CFFI to 1.12

Makes sense


If you don't mind marking cibuildwheel version (See #58) as a commit, I can open a PR immediately:

uses: pypa/cibuildwheel@edd67e0d266e14537bbf2619e8c6a379ecb038fc

Or else, I can wait for next release of cibuildwheel before PR

@anibali
Copy link
Owner

anibali commented Mar 1, 2024

I'd rather wait until the next release of cibuildwheel. Thanks again for your contributions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants