Add hatch-vcs for automatic version management

Version is now derived from git tags instead of hardcoded.
This commit is contained in:
Bas Nijholt
2025-12-13 14:42:37 -08:00
parent 6133174f94
commit 8cff744c08
4 changed files with 16 additions and 4 deletions

1
.gitignore vendored
View File

@@ -1,5 +1,6 @@
# Python
__pycache__/
src/compose_farm/_version.py
*.py[cod]
*$py.class
*.so

View File

@@ -1,6 +1,6 @@
[project]
name = "compose-farm"
version = "0.1.0"
dynamic = ["version"]
description = "Compose Farm - run docker compose commands across multiple hosts"
readme = "README.md"
authors = [
@@ -18,9 +18,15 @@ dependencies = [
compose-farm = "compose_farm.cli:app"
[build-system]
requires = ["hatchling"]
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"
[tool.hatch.version]
source = "vcs"
[tool.hatch.build.hooks.vcs]
version-file = "src/compose_farm/_version.py"
[tool.hatch.build.targets.wheel]
packages = ["src/compose_farm"]

View File

@@ -1,3 +1,9 @@
"""Compose Farm - run docker compose commands across multiple hosts."""
__version__ = "0.1.0"
try:
from compose_farm._version import __version__, __version_tuple__
except ImportError:
__version__ = "0.0.0"
__version_tuple__ = (0, 0, 0)
__all__ = ["__version__", "__version_tuple__"]

1
uv.lock generated
View File

@@ -126,7 +126,6 @@ wheels = [
[[package]]
name = "compose-farm"
version = "0.1.0"
source = { editable = "." }
dependencies = [
{ name = "asyncssh" },