Skip to content

Switch to setuptools_scm for dynamic versioning#16

Merged
Jepson2k merged 1 commit into
mainfrom
switch-to-setuptools-scm
May 14, 2026
Merged

Switch to setuptools_scm for dynamic versioning#16
Jepson2k merged 1 commit into
mainfrom
switch-to-setuptools-scm

Conversation

@Jepson2k
Copy link
Copy Markdown
Collaborator

Summary

Replaces the static version = "..." line in pyproject.toml with a dynamic = ["version"] declaration backed by setuptools_scm. The version is now read from the latest git tag reachable from HEAD at build time. Tagged commits get a clean version (v0.2.6"0.2.6"); commits past a tag get a dev suffix.

What changes

  • pyproject.toml: add setuptools-scm>=8 to build-system.requires, replace version = "0.2.6" with dynamic = ["version"], add [tool.setuptools_scm] table. Removes the [tool.tbump] config block (tbump's only remaining role was tagging, which git tag already covers).
  • .github/workflows/release.yml: deleted. Its only job was to sed the version into pyproject after a release was published and push the bump back to main, which is unnecessary once the tag is the source of truth.

Why

Fixes the issue we hit on v0.2.6 where the release-time auto-bump landed on main after the tag was placed, so pip install git+...@v0.2.6 resolved metadata of 0.2.5. With dynamic versioning the tag is the version — there's no separate line to keep in sync, no force-push of tags needed.

Industry context

Standard pattern for pip-installable Python libraries (pip, setuptools, pytest, numpy, scipy, scikit-learn, sphinx, click, attrs, pydantic).

Release flow after this

  1. git tag -a vX.Y.Z -m "vX.Y.Z" on the commit you want to release
  2. git push --tags
  3. gh release create vX.Y.Z --notes "..."

pip install git+...@vX.Y.Z will report the matching version.

Follow-up

After this merges, the existing v0.2.6 tag still points at a pre-setuptools_scm commit, so it'll still install as 0.2.5. Either re-tag v0.2.6 at the post-merge commit, or cut a fresh v0.2.7 from the merged state.

Paired with sibling PRs on Jepson2k/waldoctl#1 and Jepson2k/pinokin#4.


PR description written by Claude on the author's behalf.

Version is now read from the latest git tag reachable from HEAD at
build time. Tagged commits get a clean version (v0.2.6 -> "0.2.6");
commits past a tag get a dev suffix like "0.2.7.dev3+g1234567".

Removes the static `version = "..."` line and the [tool.tbump] config
section. Deletes .github/workflows/release.yml — its only job was to
sed the version into pyproject after a release was published and
push that back to main, which is unnecessary once the tag is the
source of truth.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Jepson2k Jepson2k merged commit 8e9649a into main May 14, 2026
26 checks passed
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