This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: [doc] Undocumented behavior of importlib.metadata.version
Type: behavior Stage: resolved
Components: Documentation Versions: Python 3.11, Python 3.10, Python 3.9, Python 3.8
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: cowlinator, docs@python
Priority: normal Keywords:

Created on 2022-02-01 00:45 by cowlinator, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (3)
msg412227 - (view) Author: cowlinator (cowlinator) Date: 2022-02-01 00:45
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.
msg412228 - (view) Author: cowlinator (cowlinator) Date: 2022-02-01 00:48
I'd also like to know which `git describe` args it's using
msg412230 - (view) Author: cowlinator (cowlinator) Date: 2022-02-01 01:00
nevermind, i was just being stupid. the git describe wound up in a local egg or build metadata which i guess is where importlib.metadata.version pulls from
History
Date User Action Args
2022-04-11 14:59:55adminsetgithub: 90753
2022-02-01 01:01:05cowlinatorsetstatus: open -> closed
stage: resolved
2022-02-01 01:00:53cowlinatorsetmessages: + msg412230
2022-02-01 00:48:59cowlinatorsetmessages: + msg412228
2022-02-01 00:45:26cowlinatorcreate