Skip to content

Commit beceb09

Browse files
committed
build: only take versions from v[0-9]* tags
setuptools-scm's default describe picks the nearest tag containing a digit, so a local non-release tag (a date-stamped backup, say) could become the version and break builds with "Can't parse version from tag". Restrict describe to release tags. The legacy 0.11.0 tag, with no "v", is ignored from now on. Prompt: For some of my python-libraries, the [local backup] tag can break local hatch-vcs builds, because hatch-vcs tries to read it as a version number. This has been fixed somewhere but not everywhere. Please check [and] fix it wherever it's relevant Assisted-By: Claude Opus 5.5 Reviewed-by: Tobias Brox <tobias@redpill-linpro.com>
1 parent 34d4768 commit beceb09

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎pyproject.toml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ build-backend = "hatchling.build"
6363

6464
[tool.hatch.version]
6565
source = "vcs"
66+
# Only v<digit>* tags are releases. The default describe takes the nearest
67+
# tag containing a digit, so a date-stamped local tag (a pre-rewrite backup,
68+
# say) could become the version and break the build.
69+
raw-options = { scm = { git = { describe_command = "git describe --dirty --tags --long --abbrev=40 --match v[0-9]*" } } }
6670

6771
[tool.hatch.build.hooks.vcs]
6872
version-file = "plann/_version.py"

0 commit comments

Comments
 (0)