Skip to content

Commit

Permalink
Expand the documentation of Distribution.locate_file to explain why '…
Browse files Browse the repository at this point in the history
…locate_file' does what it does and what the consequences are of not implementing it.

Ref pypa/pip#11684
  • Loading branch information
jaraco committed Jul 25, 2024
1 parent 3f6acea commit 5ddd122
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions importlib_metadata/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,17 @@ def locate_file(self, path: str | os.PathLike[str]) -> SimplePath:
"""
Given a path to a file in this distribution, return a SimplePath
to it.
This method is used by callers of ``Distribution.files()`` to
locate files within the distribution. If it's possible for a
Distribution to represent files in the distribution as
``SimplePath`` objects, it should implement this method
to resolve such objects.
Some Distribution providers may elect not to resolve SimplePath
objects within the distribution by raising a
NotImplementedError, but consumers of such a Distribution would
be unable to invoke ``Distribution.files()``.
"""

@classmethod
Expand Down

0 comments on commit 5ddd122

Please sign in to comment.