Skip to content
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

Add in-development version support #4865

Merged
merged 4 commits into from
Nov 24, 2023

Conversation

devinrsmith
Copy link
Member

@devinrsmith devinrsmith commented Nov 20, 2023

This adds support for in-development versioning of jars and wheels. Specifically, this PR translates the java version qualifier (anything after "-") to a python "local version label" (<public version identifier>[+<local version label>]). For example, the java version "1.2.3-SNAPSHOT" becomes python version "1.2.3+snapshot"; the java version "4.5.6-my-custom-build123" becomes python version "4.5.6+my.custom.build123". By using a "local version identifier", these wheels become non-public artifacts - they can't be publicly published. While we could contemplate using "development release segments" (ie, python versios that look like "X.Y.Z.devN"), we wouldn't be able to generally translate java versions to python versions without enforcing more structure onto our java versions.

As an added benefit, this PR also reduces some of the duplication of version numbers by sourcing the version number as appropriate during the wheel building process; and then also in the runtime python code, sourcing the version information via the appropriate importlib metadata APIs.

This also improves our versioning support (now supported via property changes instead of hard-coded buildSrc changes), and gives re-builders options when defining their own version.

See https://packaging.python.org/en/latest/specifications/version-specifiers/#
See https://peps.python.org/pep-0440/

Partial #3466
Fixes #4654

This adds support for in-development versioning of jars and wheels. Specifically, this PR translates the java version qualifier (anything after "-") to a python "local version label" (`<public version identifier>[+<local version label>]`). For example, the java version "1.2.3-SNAPSHOT" becomes python version "1.2.3+SNAPSHOT"; the java version "4.5.6-my-custom-build123" becomes python version "4.5.6+my.custom.build123". By using a "local version identifier", these wheels become development-only artifacts - they can't be publicly published. While we could contemplate using "development release segments" (ie, python versios that look like "X.Y.Z.devN"), we wouldn't be able to generally translate java versions to python versions without enforcing more structure onto our java versions.

As an added benefit, this PR also reduces some of the duplication of version numbers by sourcing the version number as appropriate during the wheel building process; and then also in the runtime python code, sourcing the version information via the appropriate importlib metadata APIs.

See https://packaging.python.org/en/latest/specifications/version-specifiers/#
See https://peps.python.org/pep-0440/

Partial deephaven#3466
Fixes deephaven#4654
@cpwright
Copy link
Contributor

The properties, extra suffix, and default of using SNAPSHOT should be suitable for Enterprise and eliminate the confusion we have now about whether "0.31.0" is really the released version.

@stanbrub stanbrub self-requested a review November 21, 2023 23:27
stanbrub
stanbrub previously approved these changes Nov 21, 2023
jmao-denver
jmao-denver previously approved these changes Nov 22, 2023
Copy link
Contributor

@jmao-denver jmao-denver left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Py changes LGTM

Copy link
Member

@jcferretti jcferretti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not clear to me from the description or the code what are the changes to the release process in terms of tagging before/after release; as of before this PR, the procedure is to edit sources that mention versions (the list of files to edit is given in RELEASE.md) and put in them the version number that will be released "next" (eg, if we just released 0.29.0, the files are edited right after release to point to 0.30.0). This means that when the release comes the version to be released is already in those files, so before a release there is no need to change any versions in any files.

Since there are no changes in RELEASE.md mentioning any of that in this PR, it would seem that nothing has changed about that on this PR. But I don't understand how can that be the case given the description.

@devinrsmith
Copy link
Member Author

It is not clear to me from the description or the code what are the changes to the release process in terms of tagging before/after release; as of before this PR, the procedure is to edit sources that mention versions (the list of files to edit is given in RELEASE.md) and put in them the version number that will be released "next" (eg, if we just released 0.29.0, the files are edited right after release to point to 0.30.0). This means that when the release comes the version to be released is already in those files, so before a release there is no need to change any versions in any files.

Since there are no changes in RELEASE.md mentioning any of that in this PR, it would seem that nothing has changed about that on this PR. But I don't understand how can that be the case given the description.

There are no changes to the release part of the process - the publish workflow removes the "-SNAPSHOT" suffix automatically. After release, the manual editing of version numbers has been greatly simplified (from ~10 files -> 2 files).

jcferretti
jcferretti previously approved these changes Nov 23, 2023
mofojed
mofojed previously approved these changes Nov 23, 2023
Copy link
Member

@mofojed mofojed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice if _get_readme and _normalize_version were somehow shared between projects, but not a big deal.
Just a minor suggestion about being explicit about encoding.

Comment on lines +250 to +252
# Edit files for version change
#
authorization-codegen/protoc-gen-contextual-auth-wiring
authorization-codegen/protoc-gen-service-auth-wiring
buildSrc/src/main/groovy/io.deephaven.common-conventions.gradle
py/client-ticking/README.md
py/client-ticking/setup.py
py/client/README.md
py/client/pydeephaven/__init__.py
py/client/setup.py
py/embedded-server/deephaven_server/__init__.py
py/server/deephaven/__init__.py
gradle.properties
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Glorious. Also kind of neat how the example version bump above is 0.31.0 to 0.32.0 and was written a few months ago, which is assumedly going to actually be our next bump after this merges.

py/client-ticking/setup.py Outdated Show resolved Hide resolved
py/client/setup.py Outdated Show resolved Hide resolved
py/embedded-server/setup.py Outdated Show resolved Hide resolved
py/server/setup.py Outdated Show resolved Hide resolved
@devinrsmith
Copy link
Member Author

Would be nice if _get_readme and _normalize_version were somehow shared between projects, but not a big deal. Just a minor suggestion about being explicit about encoding.

Agreed. I think #2233 would allow this to be more easily solved - much easier to specify build related dependencies then.

@devinrsmith devinrsmith merged commit 96d126b into deephaven:main Nov 24, 2023
12 checks passed
@devinrsmith devinrsmith deleted the nightly/snapshot-versions branch November 24, 2023 17:56
@github-actions github-actions bot locked and limited conversation to collaborators Nov 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add in-development friendly versioning scheme
6 participants