-
Notifications
You must be signed in to change notification settings - Fork 66
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
ENH: delegate computing wheel tags to the packaging module #191
Conversation
d9e7993
to
4285be3
Compare
226c02b
to
4d788b1
Compare
For testing purposes, it would be great to have this fix as a pip-installable package. Is it too much to ask? |
You can use something like this: [build-system]
requires = [
"wheel",
"meson >= 0.63.3",
"meson-python @ git+https://github.com/dnicolodi/meson-python.git@packaging",
]
build-backend = "mesonpy" in a
|
Thanks. I forgot that pip can install from git repos... |
I can confirm that with this fix I am able to install scipy 1.9.3 on an M1 macOS 13. Thanks! |
something funny with
|
Indeed, although it looks like a bug in >>> import packaging.utils
>>> name, version, build, tags = packaging.utils.parse_wheel_filename('purelib_and_platlib-1.0.0-pp38-pypy38_pp73-manylinux_2_31_x86_64.whl')
>>> t = next(iter(tags))
>>> t.interpreter
'pp38'
>>> t.abi
'pypy38_pp73'
>>> t.platform
'manylinux_2_31_x86_64' Although, I am not sure what is the canonical form for pypy tags. |
Ah, no. Much simpler. I inverted interpreter and ABI tags in the test. The naming is confusing... Can someone please restart the tests? |
Some other tests fail because bugs in the tests, namely they look for the string |
Windows test were failing for an actual bug. Fixed. Can someone please kick the tests again? |
I'm coming around on some of the objections. I had a better look at the API provided by |
Looking for the string 'any' in the wheel filenames triggers when the platform tag contains the string 'manylinux'. The ABI and platform tags are anyhow verified a few lines above.
I've been looking into this some more and the main piece missing without re-implementing parts of packaging into I see two possibilities: either continue to abuse the I'll go with the first approach, for now. |
f777740
to
a8aa6fe
Compare
Use the wheel contents only to determine whether the wheel contains python ABI dependent modules or other platform dependent code. Fixes mesonbuild#142, fixes mesonbuild#189, fixes mesonbuild#190.
I think the comments have all been addressed. This is ready for another round of review. Despite there isn't in Meson yet an easy way to generate extension modules targeting the stable Python ABI, I added some synthetic tests checking that the handling of the stable ABI tag works as intended. Unfortunately, it turns out that, as I was fearing, the stable ABI tag in the extension modules filename is not only just advisory, it is not even supported on Windows: a CPython interpreter on windows does not load extension modules with filename suffix |
That's correct, on Windows you are not supposed to add the Most binding frameworks are unable to support ABI3, or have very limited support. pybind11 might start supporting it in Python 3.12, that will be the first version with enough in the Limited API to make it feasible to support. SWIG is slowly trying to support it. |
Thanks @henryiii I also found pypa/cibuildwheel#78 with some information. In general there isn't much documentation about how this is to be used. I think the only build tools that supports this is Clearly detecting the stable ABI from the extension modules filenames is not a solution, if it cannot be done on all platforms. Also, it seems that one of the goals is to have extension modules compatible with multiple Python versions, thus using the stable ABI wheel tag and the current Python interpreter version for the interpreter tag is not going to be enough. The only solution I see is a configuration parameter in [tool.meson]
python-api = "cp32" As this is an existing separate issue and Meson does not have yet an easy way to produce stable ABI extensions, I would leave solving this issue to another PR. |
Given the mention of [tool.scikit-build]
tags.py-abi = "cp32-abi3" Would target ABI3. It can also be used to build a "Pythonless" wheel (one that doesn't use Python, like ninja, cmake, or clang-format, or just has things you load via ctypes): [tool.scikit-build]
tags.py-abi = "py3-none" SKBUILD_SOABI is set to (I wonder if |
I'm a bit fuzzy on the connection between the limited API and the stable ABI. I thought that using the limited API always produces a stable ABI extension module. Doesn't it? |
Yes. The reason I settled on requesting both API and ABI tags was to have a way to specify binary tags that do not depend on Python at all; currently I think those are just as if not more common than limited API / stable ABI extensions. You could do just the api tag and CPython extensions on Linux are allowed to have just the |
I think #202 is a better approach in the long run. |
Use the wheel contents only to determine whether the wheel contains python ABI dependent modules or other platform dependent code.
Fixes #142, fixes #189, fixes #190.