Skip to content

ModuleDirImport silently fails to find distribution metadata #175

@chrisnovakovic

Description

@chrisnovakovic

In the pex bootstrap code, the ModuleDirImport class is able to act as a meta path finder owing to its implementation of find_distributions. Unfortunately it silently fails to locate any distribution metadata unless importlib-metadata happens to be included as a third-party dependency in the pex file:

https://github.com/please-build/python-rules/blob/907b778060fb318c7e1aa39eb381b13ad9fa697e/tools/please_pex/pex/pex_main.py#L208C9-L220

importlib.metadata has been part of the Python standard library since 3.8, which is the minimum version python-rules now supports anyway, so we can probably just solve this by unconditionally importing importlib.metadata instead.

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions