Skip to content

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

Description

@mattip

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.

Activity

  1. mattip commented on Nov 17, 2022

    @mattip
    ContributorAuthor

    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.

  2. mattip commented on Nov 17, 2022

    @mattip
    ContributorAuthor

    xref @FFY00

  3. eli-schwartz commented on Nov 17, 2022

    @eli-schwartz
    Contributor

    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.

  4. rgommers commented on Nov 21, 2022

    @rgommers
    Contributor

    +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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions