Don't consider dist-info in a wheel as "installed" by uranusjr · Pull Request #11217 · pypa/pip (original) (raw)

This applies to the new importlib.metadata backend. The legacy pkg_resources backend already does this (albeit accidentally).

A package inside a wheel is not guaranteed to "work" when directly imported, so we should not treat it as an installed distribution.

This fixes #11183 on our side. Note that this new logic slightly differs from the pkg_resources implementation, which blindly ignores all entries with a .whl suffix, while we only ignore files that actually look like a valid wheel. This means that something named pip.whl will not be ignored by this logic.