Skip to content

build: make git tags the source of truth for release version#318

Merged
sibson merged 2 commits into
mainfrom
fix-pypi-publish-jobs
Jul 16, 2026
Merged

build: make git tags the source of truth for release version#318
sibson merged 2 commits into
mainfrom
fix-pypi-publish-jobs

Conversation

@sibson

@sibson sibson commented Jul 16, 2026

Copy link
Copy Markdown
Owner

Summary

Follow-up to #317 (merged before this branch's later commits were pushed).

pbr derives the package version from git tags — this makes git tags the only source of truth for it, removing a second hand-maintained copy that could drift:

  • make release now reads VERSION from python setup.py --version (pbr's own git-tag-derived version), not from CHANGES.txt. VERSION='M.m.p' still works as an explicit override. CHANGES.txt's heading becomes a downstream record — rewritten with the real released version + date at release time — rather than an input.
  • New make bump-version VERSION='M.m.p' tags vM.m.p.0a1, pbr's pre-release marker convention. pbr can only auto-advance the patch version on its own between releases; this is the explicit human step for a minor/major release. Every untagged build after it computes as M.m.p.0a<N>.dev<commits> until the real vM.m.p tag lands via make release.
  • Updated CLAUDE.md's release docs to describe both commands.

Test plan

  • make -n release-tag with no pre-release tag present: derives VERSION=2.4.1 from git tags (next patch), computes NEXT_VERSION=2.4.2
  • make -n bump-version VERSION=4.5.0 prints the expected git tag/git push for v4.5.0.0a1
  • End-to-end with a local, unpushed v4.5.0.0a1 test tag (deleted after): make -n release-tag correctly picks up VERSION=4.5.0
  • Confirmed v4.5.0dev (a plausible but wrong tag format) is silently ignored by pbr — the .0aN format is required, verified via local test tag before landing on this design

🤖 Generated with Claude Code

sibson and others added 2 commits July 16, 2026 08:51
pbr now derives the package version from git tags (prior commit), so
setup.cfg no longer needs VERSION written into it -- the only place VERSION
was still required by hand was `make release`. The value was already sitting
at the top of CHANGES.txt (the "X.Y.Z (unreleased)" heading written by the
previous release's post-release bump), so read it from there and only fall
back to requiring an explicit VERSION= when that heading is missing.

Also drops the "dev" suffix from the bumped heading (e.g. "2.4.2 (unreleased)"
instead of "2.4.2dev (unreleased)") so the auto-detected value is a clean
version the awk can pass straight to `git tag` without stripping it first.

Verified with `make -n release-tag` (auto-detects 2.4.1, computes next
version 2.4.2) and `make -n release-tag VERSION=9.9.9` (override still wins).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…S.txt

The previous commit read VERSION from CHANGES.txt's "(unreleased)" heading --
a second, hand-maintained copy of the version that can drift from what pbr
actually derives from git tags, and gave pbr no way to signal a minor/major
bump (it only ever auto-advances the patch).

release-tag now reads VERSION from `python setup.py --version` (pbr's own
git-tag-derived version), stripped to the leading X.Y.Z. It rewrites
CHANGES.txt's heading with the actual released version + date rather than
assuming the heading already had the right number, since CHANGES.txt is a
downstream record now, not an input.

Add bump-version: tags vM.m.p.0a1, pbr's pre-release marker, which locks
every untagged build to that target version (as M.m.p.0a<N>.dev<commits>)
until the real vM.m.p tag lands. This is the explicit human step for a
minor/major release; patch releases need no such tag since pbr advances the
patch on its own between releases.

Verified end-to-end with dry runs and a local (unpushed, deleted after)
v4.5.0.0a1 test tag: `make -n release-tag` picks up 2.4.1 by default, and
4.5.0 once the pre-release tag is present.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@sibson sibson changed the title build: auto-detect release version from CHANGES.txt build: make git tags the source of truth for release version Jul 16, 2026
@sibson
sibson merged commit 787642e into main Jul 16, 2026
9 checks passed
@sibson
sibson deleted the fix-pypi-publish-jobs branch July 16, 2026 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant