Skip to content

Use setuptools-scm for tag-based versioning - #49

Open
leifdenby wants to merge 2 commits into
mlwp-tools:mainfrom
leifdenby:feat/scm-versioning
Open

leifdenby wants to merge 2 commits into
mlwp-tools:mainfrom
leifdenby:feat/scm-versioning

Conversation

@leifdenby

Copy link
Copy Markdown
Member

Replaces the hardcoded version = "0.1.0" with a version taken from the git tag via setuptools-scm, the same setup as mlwp-data-specs and mlwp-data-loaders (mlwp-tools/mlwp-data-loaders#20).

  • Build backend switched from hatchling to setuptools + setuptools-scm, to match the sibling packages. The wheel still contains the mxalign package and the mxalign console script.
  • The version is exposed as mxalign.__version__.
  • uv.lock: drops the static version for mxalign. The edit was made by hand to avoid lockfile-format churn from an older local uv.
  • tests.yaml now checks out with fetch-depth: 0 so tests resolve a real version, and a small test checks __version__ is set.

Verified locally: mxalign.__version__ gives 0.1.1.dev10+g5e7660ed0 (10 commits after the v0.1.0 tag), uv build works, and tests and pre-commit pass.

🤖 Generated with Claude Code

leifdenby and others added 2 commits October 29, 2026 11:35
Derive the package version from git tags (as in mlwp-data-specs and
mlwp-data-loaders) instead of a hardcoded version string, and expose it as
mxalign.__version__.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@leifdenby leifdenby left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I've read through it all and am happy with this :)

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The hand-edited uv.lock with a removed mxalign version field was validated only against an older local uv, so a human must confirm uv sync --frozen still passes in CI under the newer pinned uv before approval.

No open issues 🎉

What changed in this PR

This PR migrates mxalign from a hardcoded project version to tag-based versioning using setuptools-scm, aligning it with the sibling packages mlwp-data-specs and mlwp-data-loaders. The build backend moves from hatchling to setuptools + setuptools-scm, the version is exposed at runtime as mxalign.__version__, and CI is adjusted so the version can resolve from git tags. The changes are self-consistent: no hardcoded 0.1.0 remains in code, the console script and package discovery (src/mxalign) are preserved, and the release workflow already checks out with fetch-depth: 0 + fetch-tags: true, so setuptools-scm works there too.

Changes:

  • Switch build backend to setuptools + setuptools-scm with src-layout package discovery and a dynamic = ["version"] project version.
  • Expose the resolved version as mxalign.__version__ via importlib.metadata.version and add a sanity test.
  • Make the test workflow fetch full history (fetch-depth: 0) so tags resolve, drop the static version from uv.lock, and document the change in CHANGELOG.md.
File Description
pyproject.toml Replaces static version with dynamic = ["version"], switches to setuptools + setuptools-scm, and adds src-layout package config.
src/​mxalign/​__init__.py Imports importlib.metadata.version, exports and sets __version__.
tests/​test_version.py New test asserting __version__ is a non-empty, non-fallback string.
.github/​workflows/​tests.yaml Adds fetch-depth: 0 to the checkout so tags are available for version resolution.
uv.lock Removes the now-dynamic static version for the mxalign editable package.
CHANGELOG.md Documents the versioning/build-backend change under Unreleased.

No blocking issues were found. The change set is complete and internally consistent; the only item worth a human glance is the hand-edited uv.lock (version field removed), whose compatibility with uv sync --frozen depends on CI's pinned uv version and can't be validated in this review environment.

Review effort: Balanced

@leifdenby
leifdenby requested a review from mpvginde October 29, 2026 11:01
@mpvginde

Copy link
Copy Markdown
Contributor

Looks good! Go ahead and merge.

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.

3 participants