Hatch plugin for versioning with your preferred VCS
Project Links
Meta
Author: Ofek Lev
Classifiers
Development Status
- 4 - Beta
Programming Language
- Python
- Python :: 2.7
- Python :: 3.10
- Python :: 3.7
- Python :: 3.8
- Python :: 3.9
- Python :: Implementation :: CPython
- Python :: Implementation :: PyPy
hatch-vcs
CI/CD | |
Package | |
Meta |
This provides a plugin for Hatch that uses your preferred version control system (like Git) to determine project versions.
Table of Contents
Global dependency
Ensure hatch-vcs
is defined within the build-system.requires
field in your pyproject.toml
file.
[build-system]
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"
Version source
The version source plugin name is vcs
.
-
pyproject.toml
[tool.hatch.version] source = "vcs"
-
hatch.toml
[version] source = "vcs"
Version source options
Option | Type | Default | Description |
---|---|---|---|
tag-pattern |
str |
see code | A regular expression used to extract the version part from VCS tags. The pattern needs to contain either a single match group, or a group named version , that captures the actual version information. |
fallback-version |
str |
The version that will be used if no other method for detecting the version is successful. If not specified, unsuccessful version detection will raise an error. | |
raw-options |
dict |
A table of setuptools-scm parameters that will override any of the options listed above. The write_to and write_to_template parameters are ignored. |
Build hook
The build hook plugin name is vcs
.
-
pyproject.toml
[tool.hatch.build.hooks.vcs]
-
hatch.toml
[build.hooks.vcs]
Build hook options
Option | Type | Default | Description |
---|---|---|---|
version-file |
str |
REQUIRED | The relative path to the file that gets updated with the current version. |
template |
str |
The template used to overwrite the version-file . See the code for the default template for each file extension. |
License
hatch-vcs
is distributed under the terms of the MIT license.
May 27, 2025
0.5.0
Nov 06, 2023
0.4.0
Dec 10, 2022
0.3.0
Dec 07, 2022
0.2.1
Mar 18, 2022
0.2.0
Jan 19, 2022
0.1.0
Jan 19, 2022
0.0.1