Expose interface to locate a physical .dist-info / .egg-info directory by distribution name
#23 (closed) 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 (closed)). 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