bumpversion
bumpversion is a command-line utility for managing semantic versioning in software projects. It automates the process of updating all version strings across various files in your source code, creating commits, and tagging releases in version control systems like Git or Mercurial. The project itself is in maintenance mode, with its official GitHub repository recommending actively maintained forks like `bump2version` and `bump-my-version` for new users. The current PyPI version is 0.6.0, with an infrequent release cadence.
Warnings
- breaking Version 0.5.0 introduced significant breaking changes. The `--bump` argument was removed, making the version part (e.g., `major`, `minor`, `patch`) a required positional argument. For example, `bumpversion --bump minor` became `bumpversion minor`.
- breaking Version 0.5.0 deprecated the `files = ` configuration option in `.bumpversion.cfg`. It was replaced by a new, more granular file-specific configuration using `[bumpversion:file:...]` sections.
- gotcha By default, `bumpversion` will abort if your Git working directory is 'dirty' (contains uncommitted changes) to prevent accidental releases or loss of unsaved work. This can be a common point of friction during development.
- gotcha Without explicit `search` and `replace` patterns in your configuration, `bumpversion` uses regex-based matching that might inadvertently update unintended strings that happen to match the version pattern (e.g., a version dependency in `pyproject.toml`).
- gotcha The `current_version` must either be explicitly defined in your `.bumpversion.cfg` or easily detectable from a file. If `bumpversion` cannot determine the current version, it will fail and may require the `--current-version` CLI argument.
- deprecated The original `bumpversion` project is no longer actively maintained and explicitly recommends using actively maintained forks like `bump2version` or `bump-my-version` for new projects and ongoing development, as these forks offer continued support, new features (like `pyproject.toml` support), and bug fixes.
Install
-
pip install bumpversion
Quickstart
# 1. Create a project directory and navigate into it mkdir my_project && cd my_project # 2. Initialize a Git repository (optional, but recommended for bumpversion) git init # 3. Create an initial version file (e.g., 'VERSION' or 'my_package/__init__.py') echo "0.1.0" > VERSION # 4. Create a .bumpversion.cfg file cat <<EOF > .bumpversion.cfg [bumpversion] current_version = 0.1.0 commit = True tag = True [bumpversion:file:VERSION] EOF # 5. Make an initial commit git add .bumpversion.cfg VERSION git commit -m "Initial project setup" # 6. Bump the patch version bumpversion patch # Verify the change cat VERSION git log --oneline -2