versioningit
Versioning It with your Version In Git
What it is and what it does
versioningit is a build-system plugin that derives your package version from version control tags instead of requiring you to maintain an explicit version string in setup.py, setup.cfg, or pyproject.toml. It works as a setuptools or Hatch plugin, configured via pyproject.toml or versioningit.toml, and supports Git, Git archives, and Mercurial repositories. The plugin queries your VCS for the latest tag, calculates the version based on distance from that tag and repository state (clean, dirty, or both), and formats the result using customizable template strings.
The package's main strength is its flexibility: you can define separate format templates for different repository states (e.g., "1.2.3.post42+ge174a1f" when ahead of a tag, "1.2.3+d20230922" when uncommitted changes exist), and you can override the individual functions that extract tags, calculate versions, bump versions, and write output. It can optionally write the computed version to a file for runtime inspection or inject it into source code at build time. All three runtime dependencies are standard and lightweight.
Use it for:
- Eliminate manual version bumping in setup.py or pyproject.toml by deriving version automatically from Git tags during build.
- Customize version format via template strings without code changes to match your project's versioning scheme.
- Write computed version to a file or inject it into source code at build time for runtime access without re-querying VCS.
- Use custom version calculation logic by defining or registering entry-point functions for tag parsing, version bumping, and formatting.
- Support non-Python projects via versioningit.toml or projects using setuptools, Hatch, or library-mode setup.py integration.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Automatically determines your Python package's version from Git or Mercurial tags and writes it to your build system, with customizable version formatting and optional runtime file generation.
Yes. versioningit is actively maintained, has no known vulnerabilities, installs with low friction, and solves a real problem for projects that want version-from-VCS automation without manual version strings. It is particularly valuable if you need flexible version formatting or custom version logic. The MIT license imposes no restrictions. Install it in your build-system.requires if you use setuptools or Hatch and have Git tags.
Install
versioningit on PyPI
pip
pip install versioningituv
uv add versioningitpoetry
poetry add versioningitInstalling versioningit
Before you install
Low friction: pure Python wheel with only three lightweight runtime dependencies (importlib-metadata, packaging, tomli). Active maintenance with recent commits; last release 413 days ago but repository shows ongoing activity.
License in practice
MIT license permits commercial and private use with minimal restrictions; suitable for most projects.
Quickstart
# In pyproject.toml:
[build-system]
requires = ["setuptools", "versioningit"]
build-backend = "setuptools.build_meta"
[tool.versioningit]
# Then build your project; versioningit reads Git tags automatically.
Requires Python 3.8 or higher; repository must have at least one Git or Mercurial tag for version extraction to work.
Verify before relying
- Whether custom hooks and entry points for version calculation are well-documented and stable across versions.
- Performance characteristics when used with very large Git histories or many tags.
- Specific PEP compliance details for generated version strings across different format configurations.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — importlib-metadata, packaging, tomli |
| Maintenance | actively maintained — 413 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 2,173,943/month — #3,231 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: versioningit-3.3.0-py3-none-any.whl
Keywords: Git, Mercurial, VCS, packaging, version
Tags
More Build Tools packages
Provides reusable utilities for Python…
permissive · top 100 on PyPI
tqdmWraps any iterable to display a real-time…
copyleft · top 100 on PyPI
pippip is the standard installer for Python…
permissive · top 100 on PyPI
hatchlingHatchling is a standards-compliant Python build…
permissive · top 100 on PyPI
grpcio-toolsGenerates Python gRPC service stubs and message…
permissive · top 1,000 on PyPI
pre-commitpre-commit is a framework for installing and…
permissive · top 1,000 on PyPI
setuptools-git-versioningAutomatically generates PEP 440-compliant…
permissive · top 5,000 on PyPI
hatch-vcsA Hatch plugin that automatically determines…
permissive · top 1,000 on PyPI
setuptools-scmAutomatically extracts and manages Python…
permissive · top 1,000 on PyPI
versioneer-518Automates version management in…
permissive · top 15,000 on PyPI
versioneerVersioneer automates version management in…
permissive · top 5,000 on PyPI
read-versionExtracts a version string or other variable…
permissive · top 15,000 on PyPI
uv-dynamic-versioningA Hatch plugin that automatically derives…
permissive · top 5,000 on PyPI
charm-refresh-build-versionWrites charm version information into…
unclear · top 15,000 on PyPI
dunamaiDunamai generates dynamic, standards-compliant…
permissive · top 5,000 on PyPI
setupmetaReduces boilerplate in setup.py by…
permissive · top 5,000 on PyPI