chore: derive version from git tags via hatch-vcs

Replace hardcoded version in pyproject.toml with hatch-vcs so the
package version is read from git tags at build time. Dockerfile
accepts a VERSION build arg and passes it as HATCH_VCS_PRETEND_VERSION
for builds without a git checkout. Makefile _tag target now rebuilds
the container with the correct version automatically.
This commit is contained in:
2026-04-25 16:53:37 +10:00
parent 4651183ed1
commit cf854a2ace
3 changed files with 31 additions and 10 deletions
+5 -9
View File
@@ -1,6 +1,6 @@
[project]
name = "artifactapi"
version = "2.0.5"
dynamic = ["version"]
description = "Generic artifact caching system with support for various package managers"
dependencies = [
@@ -23,9 +23,12 @@ license = {text = "MIT"}
artifactapi = "artifactapi.main:main"
[build-system]
requires = ["hatchling"]
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"
[tool.hatch.version]
source = "vcs"
[tool.hatch.metadata]
allow-direct-references = true
@@ -40,11 +43,4 @@ dev = [
"isort>=5.12.0",
"mypy>=1.6.0",
"ruff>=0.1.0",
"bump-my-version>=1.2.0",
]
[tool.bumpversion]
current_version = "2.0.5"
commit = true
tag = true
message = "Bump version: {current_version} → {new_version}"