fix(release): derive version from git tag via hatch-vcs (#1503)#1507
Open
dimitri-yatsenko wants to merge 1 commit into
Open
fix(release): derive version from git tag via hatch-vcs (#1503)#1507dimitri-yatsenko wants to merge 1 commit into
dimitri-yatsenko wants to merge 1 commit into
Conversation
The version bump PR lands after the release tag, so version.py at each tag reports the previous release: pip install git+...@vX.Y.Z and pip show on a git install report the prior version, silently breaking version-gated code. PyPI wheels were unaffected (built from the sed'd tree). Make the git tag the single source of truth via hatch-vcs: - pyproject.toml: hatch-vcs version source + vcs build hook writing the generated src/datajoint/_version.py (git-ignored). - version.py: re-export the generated version, falling back to installed package metadata for source-tree runs. - post_draft_release_published.yaml: drop the version.py sed/commit and the follow-up bump PR; fetch full history+tags so the build resolves the tag. - RELEASE_MEMO.md: document the tag-driven flow (no manual bump, no PR).
dimitri-yatsenko
marked this pull request as ready for review
July 18, 2026 19:06
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.
Resolves finding 1 of #1503. (Findings 2–4 already landed in #1504.)
Problem
The version bump PR lands after the release tag, so
src/datajoint/version.pyat each tag still reports the previous release (at thev2.3.1tag it reads2.3.0, and so on). PyPI wheels are unaffected — they're built from the sed'd tree in the same workflow run — but:pip install git+https://github.com/datajoint/datajoint-python.git@v2.3.1→ wheel reporting2.3.0pip show datajointon that install reports2.3.0if datajoint.__version__ >= "2.3.1") silently takes the wrong branchFix — make the git tag the single source of truth (hatch-vcs)
pyproject.toml:[tool.hatch.version] source = "vcs"(+hatch-vcsbuild dep) and a[tool.hatch.build.hooks.vcs]hook that writes the resolved version to the generated, git-ignoredsrc/datajoint/_version.py.src/datajoint/version.py: re-exports the generated version, falling back to installed package metadata (importlib.metadata) for source-tree runs — sodatajoint.__version__keeps working everywhere..github/workflows/post_draft_release_published.yaml: drops theversion.pysed/commit step and the follow-up bump PR entirely; checks out withfetch-depth: 0so the build resolves the tag. Publishing thevX.Y.Ztag is now the only version action..gitignore: ignore the build-generated_version.py.RELEASE_MEMO.md: document the tag-driven flow (no manual bump, no bump PR).Verification
Built and installed locally against a throwaway
v9.9.9tag:hatchling versionat the clean tag →9.9.9;python -m build→datajoint-9.9.9-py3-none-any.whlanddatajoint-9.9.9.tar.gz(the sdist→wheel pathpip install git+…@vXuses).datajoint.__version__ == 9.9.9andimportlib.metadata.version("datajoint") == 9.9.9..devN+g<sha>version;_version.pyis git-ignored and never tracked.Notes
version.pyvalue to bump by hand anymore; the tag sets the version forpip install,pip show, anddatajoint.__version__alike.