[New-bugs-announce] [issue46774] Importlib.metadata.version picks first distribution not latest

Kevin Kirsche report at bugs.python.org
Wed Feb 16 20:41:35 EST 2022


New submission from Kevin Kirsche <Kev.Kirsche+GitHub at gmail.com>:

When using importlib.metadata.version with tools such as poetry which may install the current package one or more times, importlib.metadata.version is not deterministic in returning the latest version of the package, instead returning the first one located.

As it's unclear if this behavior is desired by importlib, I'm creating this issue to determine if this is intentional behavior or a bug.

I have opened the following poetry issue:
* https://github.com/python-poetry/poetry/issues/5204

I have also created the following reproduction repository for the installation issue:
https://github.com/kkirsche/poetry-remove-untracked

When the after is modified to return the version, it returns the first one found (e.g. if you go 3.0.0 -> 3.0.1 -> 3.0.2, each would be installed and the library would return 3.0.0 to the caller)

Thank you for your time and consideration. I apologize if this is not something that requires action by the Python team.

I'd be open to trying to submit a PR, but want to verify whether this is intentional or not.

----------
components: Library (Lib)
messages: 413375
nosy: kkirsche2
priority: normal
severity: normal
status: open
title: Importlib.metadata.version picks first distribution not latest
type: behavior
versions: Python 3.10

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46774>
_______________________________________


More information about the New-bugs-announce mailing list