-
Notifications
You must be signed in to change notification settings - Fork 7
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
Move versionstring from sydent/snapse to common #22
Conversation
and clarify that we're looking for the version of a _distribution_ package.
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.
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(".") |
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.
Is locate_file
documented?
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.
Not in the stdlib docs (which are surprisingly terse?). It is listed in the backport's API reference though.
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.
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?
the former is more explicitly a public API
Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
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.