I am interested in accessing PEP 610 metadata from Python. Is there an API for doing that?
My immediate interest was in determining if a package is installed in editable mode, but I could see wanting to get detailed version information about a VCS installed package. From looking at how pip determines this by loading and parsing direct_url.json directly, I am guessing there is no API. Also, based on that code, I see I would have to handle egg-link files (or just hope that they fall out of use over time).
Would it make sense for the direct_url.json metadata to be available from importlib.metadata, or another package?
Would it make sense for the direct_url.json metadata to be available from importlib.metadata, or another package?
I once considered moving pip’s direct_url.py to a standalone library but decided it was not worth the hassle for now, as parsing and processing the json is easy enough.
I see I would have to handle egg-link files
If you need to handle legacy editable installs, you may want to delegate the hairy details to pip, using the pip inspect command, which will emulate a direct_url for you.
Thanks! I will use Distribution.read_text() and json.loads(). It is easy enough. I just wasn’t sure what the scope of importlib.metadata was regarding the package metadata files.