Move versionstring from sydent/snapse to common#22
Merged
DMRobertson merged 10 commits intomainfrom Feb 11, 2022
Merged
Conversation
added 3 commits
February 10, 2022 18:50
and clarify that we're looking for the version of a _distribution_ package.
clokep
reviewed
Feb 11, 2022
Member
clokep
left a comment
There was a problem hiding this comment.
Looks pretty great overall! I left some questions but they're mostly me not really being familiar with importlib!
matrix_common/versionstring.py
Outdated
| version_string = module.__version__ # type: ignore[attr-defined] | ||
| distribution = Distribution.from_name(distribution_name) | ||
| version_string = distribution.version | ||
| cwd = distribution.locate_file(".") |
Contributor
Author
There was a problem hiding this comment.
Not in the stdlib docs (which are surprisingly terse?). It is listed in the backport's API reference though.
Contributor
Author
There was a problem hiding this comment.
Actually I'm not even sure if it is a backport. Maybe it's a bit like pip --- an external package later vendored into the stdlib?
added 3 commits
February 11, 2022 19:15
the former is more explicitly a public API
clokep
reviewed
Feb 11, 2022
Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
clokep
approved these changes
Feb 11, 2022
This was referenced Feb 11, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #6.
Suggest reviewing commit-by-commit.
Rather than assuming
__version__exists, use importlib to grab package metadata. (I've done this so we don't have to duplicate the version in the source code and in the packaging config.)Once merged, I'll make a minor release of the library, change synapse and sydent to require that version, and have them use the implementation in the PR.