-
Notifications
You must be signed in to change notification settings - Fork 163
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
separate __version__ from __init__ #410
Conversation
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.
Good to go but I need to adjust https://github.com/trinodb/trino-python-client/blob/master/.github/workflows/release.yml to this.
That's why I've not merged it yet.
Sorry, I missed that out. I didn't know that the next version is generated from CI.
I can simply replace |
__version__ is defined in __init__.py in trino module which means that we cannot easily use the module version in the library code because it introduces a cyclic dependency. This change introduces a _version.py which also includes other meta-information and changes setup.py to read those values from there instead of inline. The release script is also updated since the version now needs to be updated in a different file.
dca4b36
to
53e69b6
Compare
I've just reworded the commit message + squashed (otherwise there would be one commit at which point automated releases wouldn't work). Will merge once CI is finished. |
I don't think force push to a feature branch is the best approach, you can always squash merge to avoid that happening. |
Needs to be enabled per repo. We don't have it enabled on this. It's enabled on trinodb/trino but don't always squash merge since in most cases the history and smaller commits are useful. |
Description
As part of adding a user-agent to client feature #406,
trino.__version__
should be accessible within the package itself otherwise a statement such aswould cause a circular dependency. Everything within a package should be able to be imported correctly before importing the root level
__init__.py
.Having a "private" module
trino._version
to store meta info about this package is a pseudo convention that followed by many popular python libraries. GitHub contains 18.8k repos with such convention according to this search.For more explanation:
Non-technical explanation
This change will make the version information
trino.__version__
accessible from a central place within the package itself.Release notes
( ) This is not user-visible or docs only and no release notes are required.
( ) Release notes are required, please propose a release note for me.
( ) Release notes are required, with the following suggested text: