[issue46774] Importlib.metadata.version picks first distribution not latest
Jason R. Coombs
report at bugs.python.org
Sun Mar 13 14:50:42 EDT 2022
Jason R. Coombs <jaraco at jaraco.com> added the comment:
Aha. I learned how to run commands in the poetry environment... and how to locate files in that environment. With that, I figured out where the environment is and where the package metadata is coming from:
```
$ docker run -it @$(docker build -q .) bash -c 'ls $(poetry env info -p)/lib/python3.10/site-packages/poetry*'
/root/.cache/pypoetry/virtualenvs/poetry-remove-untracked-Qran5nGc-py3.10/lib/python3.10/site-packages/poetry_remove_untracked.pth
/root/.cache/pypoetry/virtualenvs/poetry-remove-untracked-Qran5nGc-py3.10/lib/python3.10/site-packages/poetry_remove_untracked-0.1.0.dist-info:
INSTALLER METADATA RECORD
/root/.cache/pypoetry/virtualenvs/poetry-remove-untracked-Qran5nGc-py3.10/lib/python3.10/site-packages/poetry_remove_untracked-0.2.0.dist-info:
INSTALLER METADATA RECORD
```
In this case, it's clear there is metadata for the `poetry-remove-untracked` package in duplicate, and importlib.metadata loads that metadata in whatever order the operating system provides it (lexicographic alphabetic sort usually). `importlib.metadata` doesn't have any means to determine which of those metadata are appropriate and doesn't support multiple versions of the same distribution being installed into the same path.
Since poetry has acknowledged this issue is a bug, I suspect there's nothing more for importlib.metadata to do here, but do please report back if you have different expectations.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46774>
_______________________________________
More information about the Python-bugs-list
mailing list