You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The location of some data files in my package changes based on whether it's PyPI or editable install. I need a programmatic way to check in the package's own code if it's installed in --editable mode.
There is an SO question with 4x as many upvotes as the highest-rated question (despite having 5 answers), indicating there's a need for this but no good existing method.
Additional context
No response
Code of Conduct
I agree to follow the PSF Code of Conduct
The text was updated successfully, but these errors were encountered:
If I am not mistaken, you can already use importlib.metadata to read the direct_url.json file that contains a recording of how the package was installed.
@janosh, I think it is not fully documented, but if I am not wrong the distribution.origin attribute will also give you the contents of direct_url.json as a dict (already parsed from the JSON file).
(Probably depends on the version of importlib.metadata you have, or if you are using the backfill importlib_metasdata, because the property was introduced a couple of months ago)
What's the problem this feature will solve?
The location of some data files in my package changes based on whether it's PyPI or editable install. I need a programmatic way to check in the package's own code if it's installed in
--editable
mode.Describe the solution you'd like
A private API for this already exists in
pip
.Alternative Solutions
There is an SO question with 4x as many upvotes as the highest-rated question (despite having 5 answers), indicating there's a need for this but no good existing method.
Additional context
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: