bump2version
Version-bump your software with a single command! This small command-line tool simplifies releasing software by updating all version strings in your source code by the correct increment. It also creates commits and tags, supports highly configurable version formats, works without any VCS but integrates with Git and Mercurial, and is compatible with Python 3 and PyPy3. This is an actively maintained fork of the original `bumpversion` project.
Warnings
- breaking The `bump2version` project is an actively maintained fork of the original `bumpversion` tool. While `pip install bumpversion` now installs `bump2version`, older documentation or direct installations of the unmaintained `bumpversion` could lead to different behavior or unpatched issues.
- gotcha If the `search` pattern in `.bumpversion.cfg` does not find a match in a file, `bump2version` may silently replace occurrences of `{current_version}` with `{new_version}` without a precise match, potentially corrupting the file's content or introducing unintended changes, instead of failing.
- gotcha Using `commit = True` in `.bumpversion.cfg` or with CLI options can cause infinite loops if combined with Git pre-commit hooks that modify files or trigger further commits.
- gotcha When bumping versions without a configuration file (`.bumpversion.cfg`), the `--current-version` argument is often required if `bump2version` cannot infer the current version from the specified files. This can be a source of confusion for new users expecting automatic detection.
Install
-
pip install bump2version
Quickstart
# 1. Create a .bumpversion.cfg file in your project root: # [bumpversion] # current_version = 0.1.0 # commit = True # tag = True # # [bumpversion:file:VERSION] # # 2. Create a file named VERSION with '0.1.0' inside. # # 3. Run the bump command: $ bump2version patch # This will update VERSION to 0.1.1, create a commit, and a tag.