Skip to main content

Hatch plugin to create a commit and tag when bumping version

Project description


PyPI - Version PyPI - Python Version

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.

requires = ["hatchling", "hatch-regex-commit"]
build-backend = ""

Version source

The version source plugin name is regex_commit.

  • pyproject.toml

    source = "regex_commit"
    path = "my_library/"
  • hatch.toml

    source = "regex_commit"
    path = "my_library/"

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.



  source = "regex_commit"
  path = "my_library/"

Custom commit message

  source = "regex_commit"
  path = "my_library/"
  commit_message = "🚀 Version {new_version}"

Edit commit message in the editor before proceeding

  source = "regex_commit"
  path = "my_library/"
  commit_extra_args = ["-e"]

Disable Git tag

  source = "regex_commit"
  path = "my_library/"
  tag = false


hatch-regex-commit is distributed under the terms of the MIT license.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hatch_regex_commit-0.0.3.tar.gz (6.3 kB view hashes)

Uploaded Source

Built Distribution

hatch_regex_commit-0.0.3-py3-none-any.whl (6.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page