Hatch plugin to create a commit and tag when bumping version
Project description
hatch-regex-commit
This provides a plugin for Hatch that automatically creates a Git commit and tag after version bumping.
Global dependency
Ensure hatch-regex-commit
is defined within the build-system.requires
field in your pyproject.toml
file.
[build-system]
requires = ["hatchling", "hatch-regex-commit"]
build-backend = "hatchling.build"
Version source
The version source plugin name is regex_commit
.
-
pyproject.toml
[tool.hatch.version] source = "regex_commit" path = "my_library/___about___.py"
-
hatch.toml
[version] source = "regex_commit" path = "my_library/___about___.py"
Version source options
This plugin inherits from the Hatch builtin Regex version source. It inherits from all its options and add the following ones:
Option | Type | Default | Description |
---|---|---|---|
check_dirty |
bool |
true | Check if the Git repository is dirty, e.g., you have uncommited changes. If you have, the version bumping will abort. |
commit |
bool |
true | Whether to create a Git commit. |
commit_message |
str |
Bump version {current_version} → {new_version} |
Template of the Git commit message. |
commit_extra_args |
list[str] |
[] | List of extra arguments for Git commit command. |
tag |
bool |
true | Whether to create a Git tag. |
tag_name |
str |
v{new_version} |
Template for the Git tag name. |
tag_message |
str |
Bump version {current_version} → {new_version} |
Template of the Git tag message. |
tag_sign |
bool |
true | Whether to sign the Git tag. |
Examples
Basic
[tool.hatch.version]
source = "regex_commit"
path = "my_library/___about___.py"
Custom commit message
[tool.hatch.version]
source = "regex_commit"
path = "my_library/___about___.py"
commit_message = "🚀 Version {new_version}"
Edit commit message in the editor before proceeding
[tool.hatch.version]
source = "regex_commit"
path = "my_library/___about___.py"
commit_extra_args = ["-e"]
Disable Git tag
[tool.hatch.version]
source = "regex_commit"
path = "my_library/___about___.py"
tag = false
License
hatch-regex-commit
is distributed under the terms of the MIT license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file hatch_regex_commit-0.0.3.tar.gz
.
File metadata
- Download URL: hatch_regex_commit-0.0.3.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.23.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa6e4b221dd8d667901c86e6357716580d278c5bba6c9343e4768c1aeb0e9b38 |
|
MD5 | 93d3870152218a64005b7db276063f86 |
|
BLAKE2b-256 | ac5004c25e5dd94443c17ef0526b627134debdbe876806a8e8ef15dddbfff54b |
File details
Details for the file hatch_regex_commit-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: hatch_regex_commit-0.0.3-py3-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.23.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7350b0bb0646f3d40898adbefb3ff58468c13bc5fa0b054400da6f7af396614d |
|
MD5 | 91c3f74945c5d3e41013861f35f52dc5 |
|
BLAKE2b-256 | 06f61ad6a367cfd54f0c4b013ff27e7037684e17f035f2269cb7ddca57c6635a |