Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Merged
timhoffm merged 1 commit intomatplotlib:masterfromtimhoffm:version_info
Jul 20, 2021

Conversation

timhoffm
Copy link
Member

@timhoffmtimhoffm commentedNov 1, 2020
edited
Loading

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.

@timhoffmtimhoffmforce-pushed theversion_info branch 2 times, most recently fromf60a16c to6827ff8CompareNovember 1, 2020 23:36
@timhoffmtimhoffm added this to thev3.4.0 milestoneNov 1, 2020
@timhoffmtimhoffmforce-pushed theversion_info branch 4 times, most recently from15c8a0e toa916604CompareNovember 2, 2020 20:37
@dopplershift
Copy link
Contributor

Outcome of today's call was that this should go ahead and mimic all the fields insys.version_info to handle our release candidates.

@timhoffm
Copy link
MemberAuthor

Waiting for#18971 before moving on.

@timhoffm
Copy link
MemberAuthor

timhoffm commentedMay 25, 2021
edited
Loading

Waiting on#19419 (in particular#19419 (comment)).

Notes to self:

  • setuptools_scm usespackaging.version.parsehttps://github.com/pypa/setuptools_scm/pull/558/files but only indump_version() (and this only creates a plain tuple, not a named tuple likesys.version_info). There seems noget_version() equivalent for tuples, i.e. some programmaticget_version_info() is missing. We'll have to implement this ourselves.
  • I don't think we can detect thereleaselevel ('alpha', 'beta', 'candidate', or 'final'), so let's stick with 'final' if there is no dev/pre/post part and choose one of 'alpha', 'beta', 'candiate' for all others.

@timhoffmtimhoffmforce-pushed theversion_info branch 2 times, most recently from4310f23 tof564e4aCompareJuly 8, 2021 21:21
@timhoffmtimhoffm marked this pull request as ready for reviewJuly 8, 2021 21:23
@jklymak
Copy link
Member

Does this need a what's new or API note?

@timhoffm
Copy link
MemberAuthor

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.

@timhoffm
Copy link
MemberAuthor

"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__
Copy link
Contributor

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.

Copy link
MemberAuthor

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.

Copy link
Contributor

@anntzeranntzer left a 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.

@timhoffmtimhoffm merged commitc328fbc intomatplotlib:masterJul 20, 2021
@timhoffmtimhoffm deleted the version_info branchJuly 20, 2021 21:47
@ericpreericpre mentioned this pull requestAug 25, 2021
2 tasks
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@anntzeranntzeranntzer approved these changes

@jklymakjklymakjklymak approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
v3.5.0
Development

Successfully merging this pull request may close these issues.

Add easily comparable version info to toplevel
5 participants
@timhoffm@dopplershift@jklymak@anntzer@QuLogic

[8]ページ先頭

©2009-2025 Movatter.jp