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

Add self-reporting of PEP 425 tags to sysconfig #99560

Open
mattip opened this issue Nov 17, 2022 · 4 comments
Open

Add self-reporting of PEP 425 tags to sysconfig #99560

mattip opened this issue Nov 17, 2022 · 4 comments
Labels
topic-sysconfig type-feature A feature request or enhancement

Comments

@mattip
Copy link
Contributor

mattip commented Nov 17, 2022

Feature or enhancement

Add pep425_python_tag(), pep425_abi_tag() and pep425_platform_tag() functions to sysconfig so the interpreter can self report.

Pitch

(Explain why this feature or enhancement should be implemented and how it would be used.
Add examples, if applicable.)

PEP 425 proposed three compatibility tags for wheel name formats: "python tag", "abi tag" and "platform tag". These are used when generating the name of a wheel to upload to PyPI and in selecting a wheel to install. Over time generation of these tags was delegated to pypa/packaging/tags.py which probes the current interpreter for information using various heuristics to generate the proper tags. This should be the job of the interpreter to self report.

Previous discussion

This came out of this comment in a PR to change the abi-tag determination, and also would provide the interfaces requested in this PR, this PR, and maybe even this pr.

@mattip mattip added the type-feature A feature request or enhancement label Nov 17, 2022
@mattip
Copy link
Contributor Author

mattip commented Nov 17, 2022

A further enhancement would allow this to be reported via the entry point call to python -m sysconfig --pep425 to make it easier for build tools like CMake and meson.

@mattip
Copy link
Contributor Author

mattip commented Nov 17, 2022

xref @FFY00

@eli-schwartz
Copy link
Contributor

eli-schwartz commented Nov 17, 2022

Over time generation of these tags was delegated to pypa/packaging/tags.py which probes the current interpreter for information using various heuristics to generate the proper tags. This should be the job of the interpreter to self report.

I think it's also contextually relevant that the reason packaging.tags exists is, in no small part, to provide a way to enumerate the set of all valid tags for all interpreters and all platforms ever. Which is the legitimate job of a package that explicitly exists outside of the stdlib in order that it shouldn't be bound to the CPython release cycle to get fixes and improvements.

But, an interpreter can definitely know its own tag (within a specific release cycle and OS, no less), and this doesn't represent something that has such high change velocity that it needs to be delegated out to a featured package distributed by PyPI.

So, for this reason I strongly believe it should be added to sysconfig so that PEP 517 build backends can know what sort of wheel tags to produce. This is particularly important for Meson, which has a bootstrapping policy -- and as a result, cannot depend on functionality outside of the stdlib.

@rgommers
Copy link

+1 for adding the 3 proposed functions. A note on naming: please don't include pep425 in the names, this is not good practice and there was a recent effort to get rid of names like that. Something like wheel_tag_python, wheel_tag_abi, wheel_tag_platform is better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic-sysconfig type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

4 participants