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

importlib: Read distribution name/version from metadata directory names, if possible #12656

Merged
merged 3 commits into from
Jul 9, 2024

Commits on May 8, 2024

  1. importlib: Read distribution name/version from metadata directory nam…

    …e, if possible
    
    importlib does not cache metadata in-memory, so querying even simple
    attributes like distribution names and versions can quickly become
    expensive (as each access requires reading METADATA). Fortunately,
    `Distribution.canonical_name` is optimized to parse the metadata
    directory name to query the name if possible. This commit extends this
    optimization to the finder implementation and version attribute.
    
    .egg-info directory names tend to not include the version so they are
    not considered for optimizing version lookup.
    
    simplewheel-2.0-1-py2.py3-none-any.whl had to be modified to rename the
    .dist-info directory which mistakenly included the wheel build tag (in
    violation of the wheel specification).
    
        simplewheel/__init__.py
        simplewheel-2.0-1.dist-info/DESCRIPTION.rst
        simplewheel-2.0-1.dist-info/metadata.json
        simplewheel-2.0-1.dist-info/top_level.txt
        simplewheel-2.0-1.dist-info/WHEEL
        simplewheel-2.0-1.dist-info/METADATA
        simplewheel-2.0-1.dist-info/RECORD
    
    Otherwise, it was mistaken for part of the version and led pip to think
    the wheel was a post-release, breaking tests...
    ichard26 committed May 8, 2024
    Configuration menu
    Copy the full SHA
    d247c1e View commit details
    Browse the repository at this point in the history

Commits on May 19, 2024

  1. Use str.partition over count/split

    Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com>
    ichard26 and uranusjr authored May 19, 2024
    Configuration menu
    Copy the full SHA
    93e894a View commit details
    Browse the repository at this point in the history

Commits on May 25, 2024

  1. Configuration menu
    Copy the full SHA
    80cf54f View commit details
    Browse the repository at this point in the history