setuptools-rust
setuptools-rust copied to clipboard
Generate correct tag for universal wheels
Hi!
I'm moving a Python package from using milksnake to setuptools-rust, since it is more active and it supports universal2
wheels on macOS. It mostly worked, but I hit a problem related to how milksnake supports Python's universal wheels (without dependency on the CPython API at all, because cffi
does all the work). That's how I've been generating wheels and distributing them at PyPI, but when I generate wheels with setuptools-rust
it comes out with a cp38-cp38-linux_x86_64
tag (or cp38-abi3-linux_x86_64
if using python setup.py bdist_wheel --py-limited-api=cp38
)
This PR does something similar to what milksnake
does, but it feels a bit of a hack (especially since there seems to be some pushback with universal wheels in general, now that Python 2 is no more).
Is this a change that looks acceptable, or should I look for other approaches to fix my problem?
Thanks!
According to https://packaging.python.org/guides/distributing-packages-using-setuptools/#wheels , you should only use universal = 1
if your project does not have any C extensions and supports Python 2 and 3. I'm not sure about this patch, it could easily get wrong with non-cffi packages?
cc @davidhewitt
The benefits of universal wheel is that it can run on both Python 2 and 3. Since Python 2 support is no more, if you only needs to support Python 3, using --py-limited-api=cp3x
where cp3x
is the minimal supported Python version for example cp36
should be enough? You only need to distribute a single abi3 wheel for all supported Python 3.x versions.
I'm going to close this as there's been no discussion for over a year, and it's not clear to me that this is a needed feature. If there's still desire, please feel free to comment and move discussion forward.