Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[doc] Undocumented behavior of importlib.metadata.version #90753

Closed
cowlinator mannequin opened this issue Feb 1, 2022 · 3 comments
Closed

[doc] Undocumented behavior of importlib.metadata.version #90753

cowlinator mannequin opened this issue Feb 1, 2022 · 3 comments
Labels
3.8 only security fixes 3.9 only security fixes 3.10 only security fixes 3.11 only security fixes docs Documentation in the Doc dir type-bug An unexpected behavior, bug, or error

Comments

@cowlinator
Copy link
Mannequin

cowlinator mannequin commented Feb 1, 2022

BPO 46595
Nosy @cowlinator

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2022-02-01.01:01:05.094>
created_at = <Date 2022-02-01.00:45:26.673>
labels = ['type-bug', '3.8', '3.9', '3.10', '3.11', 'docs']
title = '[doc] Undocumented behavior of importlib.metadata.version'
updated_at = <Date 2022-02-01.01:01:05.094>
user = 'https://github.com/cowlinator'

bugs.python.org fields:

activity = <Date 2022-02-01.01:01:05.094>
actor = 'cowlinator'
assignee = 'docs@python'
closed = True
closed_date = <Date 2022-02-01.01:01:05.094>
closer = 'cowlinator'
components = ['Documentation']
creation = <Date 2022-02-01.00:45:26.673>
creator = 'cowlinator'
dependencies = []
files = []
hgrepos = []
issue_num = 46595
keywords = []
message_count = 3.0
messages = ['412227', '412228', '412230']
nosy_count = 2.0
nosy_names = ['docs@python', 'cowlinator']
pr_nums = []
priority = 'normal'
resolution = None
stage = 'resolved'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue46595'
versions = ['Python 3.8', 'Python 3.9', 'Python 3.10', 'Python 3.11']

@cowlinator
Copy link
Mannequin Author

cowlinator mannequin commented Feb 1, 2022

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.

@cowlinator cowlinator mannequin added 3.8 only security fixes 3.9 only security fixes 3.10 only security fixes 3.11 only security fixes labels Feb 1, 2022
@cowlinator cowlinator mannequin assigned docspython Feb 1, 2022
@cowlinator cowlinator mannequin added docs Documentation in the Doc dir type-bug An unexpected behavior, bug, or error 3.8 only security fixes 3.9 only security fixes 3.10 only security fixes 3.11 only security fixes labels Feb 1, 2022
@cowlinator cowlinator mannequin assigned docspython Feb 1, 2022
@cowlinator cowlinator mannequin added docs Documentation in the Doc dir type-bug An unexpected behavior, bug, or error labels Feb 1, 2022
@cowlinator
Copy link
Mannequin Author

cowlinator mannequin commented Feb 1, 2022

I'd also like to know which git describe args it's using

@cowlinator
Copy link
Mannequin Author

cowlinator mannequin commented Feb 1, 2022

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

@cowlinator cowlinator mannequin closed this as completed Feb 1, 2022
@cowlinator cowlinator mannequin closed this as completed Feb 1, 2022
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.8 only security fixes 3.9 only security fixes 3.10 only security fixes 3.11 only security fixes docs Documentation in the Doc dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

0 participants