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`.
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: