python / importlib_metadata

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

fix `PathDistribution._normalized_name` implementation #377

Closed benoit-pierre closed 2 years ago

benoit-pierre commented 2 years ago

Both are necessary, or entry_points(…) can yield the entry-points of a shadowed distribution. For example: with a version of mypkg in the system' site-packages directory when working from another development checkout of the same package (with a mypgk.egg-info directory mishandled by the first bug).

jaraco commented 2 years ago

Thanks @benoit-pierre for this proposal. Unfortunately, I'm struggling a little bit with it, mainly because it fixes two unreported bugs in one commit. I'm also uneasy about the added complexity that "normalized names" is adding here (requiring fixtures with multiple return values). Would you mind writing up a bug report describing how you encountered this bug and how we might replicate it (and prove the fix)?

I'm a little disappointed in the test suite right now. It seems the performance tests aren't running. Also, the linter didn't catch that name was shadowed and never used, which might have been an indicator that something was wrong.

jaraco commented 2 years ago

In #379, I've addressed the first issue.

jaraco commented 2 years ago

In #381, I've found I can capture the missed expectation by simply tweaking the test for test_entry_points_unique_packages to include the expected normalization.

jaraco commented 2 years ago

These changes are superseded by #379 and #381. Thanks for the contrib.