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

Document how to write a DistributionFinder subclass #427

Open
pfmoore opened this issue Jan 21, 2023 · 2 comments
Open

Document how to write a DistributionFinder subclass #427

pfmoore opened this issue Jan 21, 2023 · 2 comments
Assignees

Comments

@pfmoore
Copy link
Member

pfmoore commented Jan 21, 2023

I've been asked to implement a meta path hook to provide metadata - see pfmoore/editables#23.

I think that what I need to do is write a custom DistributionFinder subclass which I add to sys.meta_path. But the documentation doesn't give much help on how to do that - and a lot of the key classes appear to be undocumented. For example, PackageMetadata and EntryPoints, as well as any functions/APIs that exist to parse the contents of a METADATA (respectively entry_points.txt) file into those objects (I don't really want to reimplement that functionality myself, when it's clearly already available for the standard finders).

Could the documentation be extended to include an example of how to write a complete distribution finder?

@jaraco
Copy link
Member

jaraco commented Apr 11, 2023

I'll see what I can do. There is one example of which I'm aware in Rinoh, although that project does seem to be exhibiting the concerns you've described. I'll take a look and see if I can't come up with a simpler example.

@jaraco
Copy link
Member

jaraco commented Dec 15, 2023

I've opened python/cpython#113187 in an attempt to document an example. Please take a look and let me know if that helps or what questions remain.

@jaraco jaraco reopened this May 1, 2024
SonicField pushed a commit to SonicField/cpython that referenced this issue May 8, 2024
* Expand the 'Extending' docs to provide a minimal example. Closes python/importlib_metadata#427.

Co-authored-by: Hugo van Kemenade <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants