Repository navigation
Conversation
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
left a comment
There was a problem hiding this comment.
I've read through it all and am happy with this :)
There was a problem hiding this comment.
🔵 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-scmwith src-layout package discovery and adynamic = ["version"]project version. - Expose the resolved version as
mxalign.__version__viaimportlib.metadata.versionand add a sanity test. - Make the test workflow fetch full history (
fetch-depth: 0) so tags resolve, drop the static version fromuv.lock, and document the change inCHANGELOG.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
|
Looks good! Go ahead and merge. |
Replaces the hardcoded
version = "0.1.0"with a version taken from the git tag viasetuptools-scm, the same setup asmlwp-data-specsandmlwp-data-loaders(mlwp-tools/mlwp-data-loaders#20).mxalignpackage and themxalignconsole script.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.yamlnow checks out withfetch-depth: 0so tests resolve a real version, and a small test checks__version__is set.Verified locally:
mxalign.__version__gives0.1.1.dev10+g5e7660ed0(10 commits after thev0.1.0tag),uv buildworks, and tests and pre-commit pass.🤖 Generated with Claude Code