Skip to main content

This is a package to bump version numbers in a project. Fully automated versioning. Refer to bump2version package instructions.

Project description

A CLI wrapper and native fork of bump2version for automated semantic versioning. Bumps version numbers across files, commits, tags, and pushes – all in one command.

pip install bump2v

How it works

bump2v reads your current version from a config file, increments it, rewrites it in every file you specify, commits the change, creates a git tag, and pushes – all in one command. The source of truth for the version lives in your project’s main file:

  • Node.js / React / JSpackage.json -> "version": "1.0.0"

  • PythonappInfo.py -> __version__ = "1.0.0"

  • Any other file – configurable via .bumpversion.cfg

The .bumpversion.cfg file tells bump2v where to find and update that version string. You only need to run bump2v – never edit the version manually.


Quick Start

Step 1: Make your code change.

Step 2: Stage and commit.

git add .
git commit -m "fix: describe your change here"

Step 3: Bump the version and push.

bump2v patch   # 1.0.0 -> 1.0.1  (bug fix)
bump2v minor   # 1.0.0 -> 1.1.0  (new feature)
bump2v major   # 1.0.0 -> 2.0.0  (breaking change)

Alternative command aliases: bumptydumpty, versionkaboom


Setup by project type

Node.js / React

The version lives in package.json. bump2v finds and updates it there.

.bumpversion.cfg:

[bumpversion]
current_version = 1.0.0
commit = True
tag = True
message = Version Updated: {current_version} -> {new_version} [skip ci]

[bumpversion:file:package.json]
search = "version": "{current_version}"
replace = "version": "{new_version}"

The current_version in .bumpversion.cfg must always match the "version" field in package.json. bump2v keeps them in sync automatically – never edit either one by hand.

Python

The version lives in appInfo.py (or wherever you store your app metadata).

app/appInfo.py:

app_name = "Your App Name"
__version__ = "1.0.0"
description = "Describe your app here"

main.py:

from appInfo import __version__, app_name, description

app = FastAPI(
    title=app_name,
    description=description,
    version=__version__,
)

.bumpversion.cfg:

[bumpversion]
current_version = 1.0.0
commit = True
tag = True
message = Version Updated: {current_version} -> {new_version} [skip ci]

[bumpversion:file:app/appInfo.py]
search = __version__ = "{current_version}"
replace = __version__ = "{new_version}"

Multiple files

You can target as many files as needed:

[bumpversion]
current_version = 1.0.0
commit = True
tag = True

[bumpversion:file:package.json]
search = "version": "{current_version}"
replace = "version": "{new_version}"

[bumpversion:file:app/appInfo.py]
search = __version__ = "{current_version}"
replace = __version__ = "{new_version}"

Semantic Versioning

  • bump2v patch1.0.0 -> 1.0.1 – Bug fixes, minor improvements

  • bump2v minor1.0.0 -> 1.1.0 – New backward-compatible features

  • bump2v major1.0.0 -> 2.0.0 – Breaking changes


Advanced Flags

--tag-only – Tag without bumping

Tags the current HEAD using current_version from config, without bumping or committing. Useful when you need to commit a build artifact between the version bump commit and the release tag.

bump2v patch --no-tag       # bump + commit, skip the tag
# ... build artifact, git add, git commit ...
bumpversion --tag-only      # tag HEAD now

Fixes #256.

--ignore-missing-version – Skip files without a version string

When using glob patterns, some files may not contain the version string. Instead of crashing, bump2v logs a warning and skips those files.

bump2v patch --ignore-missing-version

Or set it permanently in config:

[bumpversion]
ignore_missing_version = True

Fixes #267.

--extra-files – Include generated files in the bump commit

Stage additional files alongside the version bump commit, even if not modified by bumpversion. Files can be dirty or untracked.

bump2v patch --extra-files docs/changelog.md dist/summary.txt

Or set them in config:

[bumpversion]
extra_files = docs/changelog.md dist/summary.txt

Fixes #259.

sign_tags config fix

Setting sign_tags = False in .bumpversion.cfg now works correctly. Previously it was silently ignored, causing GPG signing attempts to fail.

[bumpversion]
sign_tags = False

Fixes #269.


Full Config Reference

[bumpversion]
current_version = 1.0.0
commit = True
tag = True
sign_tags = False
message = Version Updated: {current_version} -> {new_version} [skip ci]
tag_name = v{new_version}
tag_message = Release {new_version}
commit_args =
ignore_missing_version = False
extra_files =

[bumpversion:file:package.json]
search = "version": "{current_version}"
replace = "version": "{new_version}"

Tips

Remove all local tags if you need to reset:

git tag -l | xargs -n 1 git tag -d

Contributors

Maintained and extended by @maimul.

Built on top of bump2version by Christian Verkerk.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bump2v-1.5.3-py3-none-any.whl (21.0 kB view details)

Uploaded Python 3

File details

Details for the file bump2v-1.5.3-py3-none-any.whl.

File metadata

  • Download URL: bump2v-1.5.3-py3-none-any.whl
  • Upload date:
  • Size: 21.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for bump2v-1.5.3-py3-none-any.whl
Algorithm Hash digest
SHA256 11cea05faa745688bd77abaf80f99184dfd0a4ae52d99f1a03bdb4d21cffb455
MD5 e1b359f4249b568b72e136b4816ec08a
BLAKE2b-256 b58061f9193df778c06f3b1d993c7ade7e84ae075301d929993fe72e2d93a5d0

See more details on using hashes here.

Supported by

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