build: Configure automatic versioning from git tags

- Use setuptools-scm for automatic version detection
- Version now automatically derived from git tags
- No need to manually update version in pyproject.toml
- Added _version.py to .gitignore

This enables automatic patch version bumping through git tags without
manually updating any configuration files.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Simone Scarduzio
2025-09-23 08:35:24 +02:00
parent 02bce80537
commit b788999072
4 changed files with 52 additions and 9 deletions

2
.gitignore vendored
View File

@@ -81,4 +81,4 @@ docs/_static/
docs/_templates/
# Logs
*.log
*.logsrc/deltaglider/_version.py

View File

@@ -1,6 +1,10 @@
[build-system]
requires = ["setuptools>=61.0", "setuptools-scm>=8.0"]
build-backend = "setuptools.build_meta"
[project]
name = "deltaglider"
version = "0.1.0"
dynamic = ["version"]
description = "Store 4TB in 5GB: S3-compatible storage with 99.9% compression for versioned files"
authors = [
{name = "Beshu Tech", email = "info@beshu.tech"},
@@ -74,12 +78,6 @@ dev = [
[project.scripts]
deltaglider = "deltaglider.app.cli.main:main"
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.hatch.build.targets.wheel]
packages = ["src/deltaglider"]
[tool.hatch.build.targets.sdist]
include = [
@@ -111,8 +109,15 @@ dev-dependencies = [
"mypy>=1.13.0",
"boto3-stubs[s3]>=1.35.0",
"types-python-dateutil>=2.9.0",
"setuptools-scm>=8.0.0",
]
[tool.setuptools_scm]
# Automatically determine version from git tags
write_to = "src/deltaglider/_version.py"
version_scheme = "post-release"
local_scheme = "no-local-version"
[tool.ruff]
target-version = "py311"
line-length = 100

View File

@@ -1,3 +1,7 @@
"""DeltaGlider - Delta-aware S3 file storage wrapper."""
__version__ = "0.1.0"
try:
from ._version import version as __version__
except ImportError:
# Package is not installed, so version is not available
__version__ = "0.0.0+unknown"

View File

@@ -0,0 +1,34 @@
# file generated by setuptools-scm
# don't change, don't track in version control
__all__ = [
"__version__",
"__version_tuple__",
"version",
"version_tuple",
"__commit_id__",
"commit_id",
]
TYPE_CHECKING = False
if TYPE_CHECKING:
from typing import Tuple
from typing import Union
VERSION_TUPLE = Tuple[Union[int, str], ...]
COMMIT_ID = Union[str, None]
else:
VERSION_TUPLE = object
COMMIT_ID = object
version: str
__version__: str
__version_tuple__: VERSION_TUPLE
version_tuple: VERSION_TUPLE
commit_id: COMMIT_ID
__commit_id__: COMMIT_ID
__version__ = version = '0.1.1.post0'
__version_tuple__ = version_tuple = (0, 1, 1, 'post0')
__commit_id__ = commit_id = 'g02bce8053'