Versioning
lauren uses setuptools-scm
to derive the package version directly from git tags. There is no
version = "..." string anywhere in the codebase — the tag is the
version.
How It Works
setuptools-scm inspects the git repository at build time:
- If
HEADpoints to an annotated tag matchingvX.Y.Z, the version isX.Y.Z. - If there are commits after the latest tag, a
postsuffix is appended:X.Y.Z.postN+gHASH. - If the working tree is dirty (uncommitted changes), a
+dsuffix is added:X.Y.Z.postN+gHASH.dYYYYMMDD. - If no tag exists at all (fresh clone without tags), the fallback
is
0.0.0+unknown.
The resolved version is written into the installed package's metadata
so that importlib.metadata.version("lauren") always returns the
correct string at runtime.
At Runtime
lauren/__init__.py exposes __version__:
import lauren
print(lauren.__version__) # e.g. "1.2.3"The implementation uses importlib.metadata with a safe fallback:
try:
from importlib.metadata import version
__version__ = version("lauren")
except PackageNotFoundError:
__version__ = "0.0.0+unknown"The fallback fires only in rare edge cases (e.g., running from a raw
checkout without installing the package). In all normal workflows
(pip install -e ., pip install lauren) the metadata is present.
Tagging Conventions
| Tag format | Used for |
|---|---|
v1.2.3 | Stable release |
v1.2.3rc1 | Release candidate |
v1.2.3b1 | Beta |
v1.2.3a1 | Alpha |
PEP 440 pre-release identifiers are appended directly to the numeric
version, e.g. 1.2.3rc1.
Creating a Tag
# Annotated tag (recommended — becomes the GitHub Release description):
git tag -a v1.2.3 -m "Release v1.2.3"
git push origin v1.2.3Listing Tags
git tag -l "v*" | sort -VDeleting a Mistaken Tag (before pushing)
git tag -d v1.2.3If the tag has already been pushed, coordinate with the team before deleting it remotely — PyPI will reject re-uploads of the same version.
pyproject.toml Configuration
[build-system]
requires = ["setuptools>=61.0", "setuptools-scm>=8.0"]
build-backend = "setuptools.build_meta"
[project]
dynamic = ["version"]
[tool.setuptools_scm]
fallback_version = "0.0.0+unknown"
version_scheme = "post-release"
local_scheme = "dirty-tag"version_scheme = "post-release" uses the X.Y.Z.postN format for
commits after a tag. local_scheme = "dirty-tag" appends a date
suffix when there are uncommitted changes.