Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Add __version_info__ as a tuple-based version identifier#18869
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
f60a16c
to6827ff8
Compare15c8a0e
toa916604
CompareOutcome of today's call was that this should go ahead and mimic all the fields in |
Waiting for#18971 before moving on. |
timhoffm commentedMay 25, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Waiting on#19419 (in particular#19419 (comment)). Notes to self:
|
4310f23
tof564e4a
CompareDoes this need a what's new or API note? |
Yes, I think "What's new" would be appropriate. I noticed that the switch to release-branch-semver does not have one either. Will do a combined one. |
"What's new" added. |
This is a named tuple modelled after sys.version_info.
__version__ = _get_version() | ||
global __version__info__ # cache it. | ||
__version_info__ = _parse_to_version_info(__version__) | ||
return __version__ if name == "__version__" else __version_info__ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I would doreturn globals()[name]
as that seems more robust if we ever want to add more entries to the module-level__getattr__
, but I'm not going to block over that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I'll leave this as is because explicit is better and still simple enough for two cases. We can (and should) switch to your proposal if we add more entries.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Please address my comment above or explicitly reject it; then this can be self-merged.
Uh oh!
There was an error while loading.Please reload this page.
PR Summary
Closes#18312. See there for general background and discussion.
This implementation truncates the version to
(major, minor, micro)
. GitHub post-tag number and commit are left out: The commit ID must be left out because it is not ordered, and the tuple is specifically intended to be compared. One could leave the post-tag number. However, this is non-standard. Moreover git post-tag numbers only appear in development versions and and I doubt there's a use-case for checking only that. So let's keep it simple and to the(major, minor, micro)
tuple.One can always expand later with additional parameters or switching to a namedtuple. if there is need.