[New-bugs-announce] [issue46595] [doc] Undocumented behavior of importlib.metadata.version

cowlinator report at bugs.python.org
Mon Jan 31 19:45:26 EST 2022

New submission from cowlinator <cowlinator at gmail.com>:

If `importlib.metadata.version` can't find the distribution version, it seems to return the result of a local `git describe`.  I don't know if this is git-specific, or which other SCMs this might try to interact with.

The result of `importlib.metadata.version` varies depending on whether the local directory happens to be a git repo.

This is unexpected and undocumented. Based on the documentation, I expected that when it couldn't find the distribution version, it would ALWAYS raise and exception or return nothing.

In order to properly document this, you'll have to figure out all of the SCMs that it might interact with.

assignee: docs at python
components: Documentation
messages: 412227
nosy: cowlinator, docs at python
priority: normal
severity: normal
status: open
title: [doc] Undocumented behavior of importlib.metadata.version
type: behavior
versions: Python 3.10, Python 3.11, Python 3.8, Python 3.9

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list