python / importlib_metadata

Library to access metadata for Python packages
https://importlib-metadata.readthedocs.io
Apache License 2.0
122 stars 79 forks source link

Provide a 'diagnose' routine to help users inspect broken environments #461

Closed jaraco closed 7 months ago

jaraco commented 1 year ago

In python/cpython#100455, a user describes a way to inspect / diagnose the environment when importlib.metadata chokes on a corrupt or invalid environment. This gives me an idea - what if importlib provided a routine to inspect the environment and give the user hints as to what is going wrong. I'm thinking something like:

python -m importlib_metadata.diagnose
Inspecting .
Inspecting /usr/local/lib/python/site-packages
Found 13 packages (pip, backports.pdb, ..., foopkg)
Warning: foopkg has no `.name`.
jaraco commented 7 months ago

I'd like to improve this more, but since I got something working, I decided to get it out.