Adopt hatch-vcs for tag-driven versioning - #112
Merged
Conversation
Derive the package version from git tags via hatch-vcs so releases no longer require a manual pyproject.toml version bump before tagging. Mirrors the intent of magpie#74. - pyproject.toml: dynamic version, hatch-vcs build dep, vcs source - release.yml + ci.yml: fetch full history (fetch-depth: 0) so tags resolve - uv.lock: regenerated
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.
Summary
Replace the static
version = "0.1.0"inpyproject.tomlwith a dynamic version derived from git tags viahatch-vcs, so cutting a release is justgit tag vX.Y.Z && git push— no manual version bump. Mirrors the intent of magpie#74.No source code changes required:
vesper/__init__.pyalready reads the version viaimportlib.metadata.version("vesper")(with a0.1.0fallback for source-tree runs), andvesper/a2a.pysurfaces__version__in the A2A agent card and FastAPI app. Because the version is already sourced from distribution metadata, this is purely a build-configuration change plus the release/CI workflows and the lockfile.Changes
pyproject.toml— makeversiondynamic; addhatch-vcsto[build-system].requires; add a[tool.hatch.version]block (source = "vcs",fallback-version = "0.0.0"). The fallback ensures builds never hard-fail in environments lacking git metadata (e.g. GitHub source archives), while real releases still resolve the correct tag..github/workflows/release.yml&.github/workflows/ci.yml— addfetch-depth: 0toactions/checkout. Without this, the shallow checkout causeshatch-vcs/setuptools-scmto resolve the version to the0.0.0fallback — in CI this is silent because the version-matching test (test_agent_card_version_matches_package_metadata) would pass with both sides equal to0.0.0, and in release it would ship a broken0.0.0release.uv.lock— regenerated. The rootvesperpackage entry no longer pinsversion = "0.1.0"(now resolved at build time). Note:uv lockalso refreshed incidental environment-marker metadata on two transitive deps (aiologic,culsans) — these are benign registry-metadata refreshes, not caused by hatch-vcs.Verification
Run from the feature branch (2 commits past the
v0.1.0tag, so a dev version is the expected, correct result — proves tag-driven versioning is working rather than resolving to0.0.0or a hardcoded literal):Also confirmed the tagged commit itself (
v0.1.0@786bdcf) yields a clean0.1.0via a scratch git worktree:The key regression test
tests/test_a2a.py::test_agent_card_version_matches_package_metadata(asserts the agent-cardversionequalsvesper.__version__) continues to pass — both derive from the same dist metadata.