Skip to content

Expose interface to locate a physical .dist-info / .egg-info directory by distribution name #111

Description

@jaraco

In GitLab by @uranusjr on Feb 17, 2020, 20:29

#23 discussed whether it’d be possible to make the distribution’s _path attribute public. While I understand the rational behind not exposing it, IMO there are cases when a tool wants to find a distribution on disk. One example would be project tools wanting to perform a “clean” operation that cleans up previously-built package metadata.

Under those circumstances, the need is not to find a Distribution, and then locate it on disk (this does not make sense), but to find a dist/egg-info directory on disk (and then turn it into a Distributon; this is already possible with #90). One way to do that would be to add an interface to do something like

def locate_dist_dir(name):
    for path in MetadataPathFinder._search_paths(sys.path):
        if Distribution.at(path).metadata['Name'] == name:
            yield path

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions