Registry / devops / bumpversion

bumpversion

JSON →
library0.6.0pypypiunverified

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.

pip install bumpversion
INSTALL
IMPORT
SIG · BUMPVERSION
B
bumpversion
devopspythonv0.6.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

This quickstart demonstrates how to set up `bumpversion` for a simple project, initialize a version file and a configuration file, and then perform a version bump. It includes Git commands as `bumpversion` integrates closely with Git for committing and tagging. The `current_version` in `.bumpversion.cfg` must match the version string found in your files.

# 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
bumpversion --version
Debug
Known issues
breakingVersion 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`.
fix
Update your CLI commands to use the version part as a positional argument: `bumpversion <part>` (e.g., `bumpversion patch`).
affects: >=0.5.0
breakingVersion 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.
fix
Migrate your configuration from `files = file1 file2` to individual sections like `[bumpversion:file:file1]` and `[bumpversion:file:file2]`.
affects: >=0.5.0
gotchaBy 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.
fix
Always commit your changes before running `bumpversion`. If you intentionally want to bypass this check, use the `--allow-dirty` command-line option, but exercise caution.
affects: All versions
gotchaWithout 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`).
fix
For critical files, always use specific `search = "version = {current_version}"` and `replace = "version = {new_version}"` patterns in your `[bumpversion:file:...]` sections to precisely target the version string.
affects: All versions
gotchaThe `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.
fix
Ensure your `.bumpversion.cfg` (or `setup.cfg`/`pyproject.toml`) has `current_version = X.Y.Z` defined, or that your version files are consistently formatted for automatic detection.
affects: All versions
deprecatedThe 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.
fix
Consider installing and migrating to `bump2version` (`pip install bump2version`) or `bump-my-version` (`pip install bump-my-version`) for better long-term support.
affects: All versions
Errors
Common errors & fixes
bumpversion: error: the following arguments are required: part
The `bumpversion` command was called without specifying which part of the version to increment (e.g., `major`, `minor`, `patch`).
fix
Run the command with a specified version part, for example: `bumpversion patch` or `bumpversion minor`.
subprocess.CalledProcessError: Command '['git', 'commit', u'-F', ...]' returned non-zero exit status 1
`bumpversion` attempted to perform a Git commit, but the Git command failed, often due to issues like GPG signing configuration, an empty commit message, or pre-commit hooks blocking the commit.
fix
Address the underlying Git issue (e.g., configure GPG signing correctly or temporarily disable it, ensure commit message is valid), or use `bumpversion --no-commit` and commit manually.
bumpversion.exceptions.VersionNotFoundException: Did not find 'X.Y.Z' in file: 'filename.py'
`bumpversion` could not locate the `current_version` string (e.g., 'X.Y.Z') within one of the files it's configured to update. This often happens due to a mismatch between the `current_version` defined in `.bumpversion.cfg` and the actual version string in the target file, or an incorrect `search` pattern.
fix
Ensure the `current_version` in your `.bumpversion.cfg` accurately reflects the current version in your files, and verify that the `search` and `replace` patterns are correctly defined to match your version string format in the target files.
fatal: No names found, cannot describe anything.
This Git error occurs when `bumpversion` tries to infer the `current_version` from Git tags using `git describe`, but the repository does not contain any tags.
fix
Manually specify the `current_version` in your `.bumpversion.cfg` file or via the `--current-version` command-line argument for the initial bump. After the first successful bump, ensure `bumpversion` creates a tag, which it can then use for subsequent operations.
Upgrade
Version history
0.6.0latest on PyPI · released May 14, 2020
Audit
Dependencies

No dependency data recorded yet.

Agent activity
8 hits · last 30 days
node
6
Resources
bumpversion — pip install bumpversion · libregistry