setuptools-git-versioning
Use git repo data for building a version number according to PEP-440
Decision gist · record as of 2026-08-14
Yes, if you use setuptools or scikit-build-core and want to eliminate manual version management. The package is actively maintained, has no known vulnerabilities, low install friction, and a permissive license. The main constraint is that it requires a git repository and Git v2; if your build process does not have git available or you use a different build backend (Poetry, etc.), it will not work.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires a Git repository and Git v2 to be present; only works with setuptools or scikit-build-core build backends, not Poetry or others.
- Low friction installation with a pure-wheel distribution.
- Actively maintained as of 2026-05-15 with recent commits.
License · maintenance · safety
MIT (permissive) — MIT license permits unrestricted use, modification, and distribution in both open-source and proprietary projects with minimal restrictions.
last release 2026-05-15 (91 days) · last repo commit 2026-08-07 · 71 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 1,571,890 downloads/mo, #3,749 on PyPI
Alternatives
Verify before relying
# In pyproject.toml:
[build-system]
requires = ["setuptools>=41", "wheel", "setuptools-git-versioning>=3.0,<4"]
build-backend = "setuptools.build_meta"
[tool.setuptools-git-versioning]
enabled = true
[project]
dynamic = ["version"]
# Then run:
$ setuptools-git-versioning
# Output: 0.0.1 (or version based on git tag)- Whether the package handles shallow clones or sparse checkouts correctly.
- Performance impact when called repeatedly during complex multi-stage builds.
- Compatibility with monorepo setups where multiple packages share a single git root.
What it is and what it does
setuptools-git-versioning is a setuptools plugin that derives your package's version number directly from your git repository state at build time. Instead of hardcoding a version string in setup.py or pyproject.toml, it reads git tags, commit hashes, and dirty status to generate a PEP 440-compliant version automatically. This eliminates the need to manually bump version strings before releases and keeps your version source-of-truth in git tags.
The plugin integrates into the build process via setuptools' build backend or scikit-build-core, supporting both pyproject.toml and setup.py configuration. It offers tag-based, file-based, and callback-based versioning schemas with customizable templates for tagged, development, and dirty-state versions. Configuration is minimal—typically just enabling the plugin and marking version as dynamic—and it requires only git v2 and setuptools to be available.
Use it for
- Automatically version releases by creating git tags without editing version strings in source files.
- Generate development versions with commit hashes for pre-release builds and CI/CD pipelines.
- Mark builds from uncommitted changes with a 'dirty' suffix to distinguish development snapshots from clean releases.
- Maintain a single source of truth for versioning in git history rather than scattered version strings across the codebase.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you use setuptools or scikit-build-core and want to eliminate manual version management.
The package is actively maintained, has no known vulnerabilities, low install friction, and a permissive license. The main constraint is that it requires a git repository and Git v2; if your build process does not have git available or you use a different build backend (Poetry, etc.), it will not work.
Install
setuptools-git-versioning on PyPI
Before you install
Low friction installation with a pure-wheel distribution. Actively maintained as of 2026-05-15 with recent commits. Three lightweight runtime dependencies (packaging, setuptools, tomli) that are commonly already present in build environments.
Requires a Git repository and Git v2 to be present; only works with setuptools or scikit-build-core build backends, not Poetry or others.
License in practice
MIT license permits unrestricted use, modification, and distribution in both open-source and proprietary projects with minimal restrictions.
Quickstart
# In pyproject.toml:
[build-system]
requires = ["setuptools>=41", "wheel", "setuptools-git-versioning>=3.0,<4"]
build-backend = "setuptools.build_meta"
[tool.setuptools-git-versioning]
enabled = true
[project]
dynamic = ["version"]
# Then run:
$ setuptools-git-versioning
# Output: 0.0.1 (or version based on git tag)
Verify before relying
- Whether the package handles shallow clones or sparse checkouts correctly.
- Performance impact when called repeatedly during complex multi-stage builds.
- Compatibility with monorepo setups where multiple packages share a single git root.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.7 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 3 packagespackagingsetuptoolstomli |
| Maintenance | Actively maintained 91 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,571,890 / month, #3,749 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Framework :: Setuptools PluginIntended Audience :: DevelopersOperating System :: OS IndependentProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9 |
Evidence: setuptools_git_versioning-3.1.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “git-based version numbering”
- setuptools-git-versioningAutomatically generates PEP 440-compliant version numbers for Python…
- setupmetaReduces boilerplate in setup.py by auto-detecting project metadata…
- looseversionProvides a drop-in replacement for the deprecated…
Give your agent the search over MCP, or paste the wish link into any chat.
More Build Tools packages
Provides reusable utilities for Python packaging interoperability, including version handling, specifiers, markers, requirements, tags, and metadata parsing according to standards like PEP 440 and PEP 425.
Wraps any iterable to display a real-time progress bar in the terminal or Jupyter notebook, showing iteration count, elapsed time, and estimated time remaining.
pip is the standard installer for Python packages, enabling you to download and install packages from the Python Package Index and other indexes into your Python environment.
Hatchling is a standards-compliant Python build backend that handles packaging, metadata, and distribution of Python projects when configured in a project's pyproject.toml file.
Generates Python gRPC service stubs and message classes from Protocol Buffer definitions, enabling developers to build gRPC clients and servers.
pre-commit is a framework for installing and running git hooks written in any language before commits are made, automating code quality and validation checks across multi-language projects.
Install it if your team needs consistent, automated validation at commit time.
See also setupmeta · setuptools-scm · versioningit · looseversion · update_checker · charm-refresh-build-version · setuptools-scm-git-archive · Incremental · setuptools-git · versioneer-518