Python: Add __version__ to the package #5315
Merged
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.
I've updated the version to
0.14.0.dev0. I'm not sure when we want to release the first version, and still tbd if we do it together with the Java stuff, or if we are going to run a separate release process.I wanted to add the version to the python side as well, so we can inject it into the HTTP headers of the rest catalog introduced in #5287.
We store the version in
__version__, which is the defacto standard way of doing this in Python: https://stackoverflow.com/questions/458550/standard-way-to-embed-version-into-python-packageFor Java we use
0.14.0-SNAPSHOTand we fetch it from theversion.txtor from the git tag itself. I've dug into replicating this logic in Python, but there it is a bit more cumbersome because we have to make sure that the logic both works when developing, and after doing a release (since we're setting the version dynamically). Just setting it through poetry (poetry version 0.14.0gives me much more peace of mind since this is the official way of poetry. Instead of having a-SNAPSHOTversion, indicating the development version, I've conformed to PEP440 and went for the.dev0postfix. We could also introduce the.rcNpostfixes in the release process. You can upload these artifacts to pypi, and everyone can give them a try, but you can only use them by explicitly stating therc, which makes the barrier for people to give the RC a try much lower.