bump-my-version 1.2.4


pip install bump-my-version

  Latest version

Released: Oct 04, 2025


Meta
Author: Corey Oordt
Requires Python: >=3.8

Classifiers

Development Status
  • 5 - Production/Stable

Environment
  • Console

Intended Audience
  • Developers

License
  • OSI Approved :: MIT License

Operating System
  • OS Independent

Programming Language
  • Python
  • Python :: 3 :: Only
  • Python :: 3.8
  • Python :: 3.9
  • Python :: 3.10
  • Python :: 3.11
  • Python :: 3.12
  • Python :: 3.13
  • Python :: Implementation :: PyPy

Topic
  • Software Development :: Build Tools
  • Software Development :: Version Control
  • System :: Software Distribution

Bump My Version

image image image codecov GitHub Actions

NOTE

This is a maintained refactor of the bump2version fork of the excellent bumpversion project. The main goals of this refactor were:

  • Add support for pyproject.toml configuration files.
  • Convert to click for and rich for the CLI interface
  • Add better configuration validation using Pydantic
  • Make the code and tests easier to read and maintain

Overview

Bump My Version's purpose is to:

  • Work as a part of an automated build system
  • Manage project versioning through the project's development life cycle
    • Incrementing and serializing version numbers
    • parsing version numbers
    • supporting SemVer, CalVer, and other versioning schemes
  • Search and replace data in project files
  • Work with the project's source control system
    • Committing changes
    • Tagging releases
    • Reading version numbers from tags

Installation

To install Bump My Version as an independent tool, use uv to install it on your system.

uv tool install bump-my-version

Changelog

Please find the changelog here: CHANGELOG.md

Semantic versioning example

Create a default configuration

The default configuration uses a simplified version of semantic versioning.

$ bump-my-version sample-config --no-prompt --destination .bumpversion.toml
$ cat .bumpversion.toml
[tool.bumpversion]
current_version = "0.1.0"
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
serialize = ["{major}.{minor}.{patch}"]
search = "{current_version}"
replace = "{new_version}"
regex = false
ignore_missing_version = false
tag = false
sign_tags = false
tag_name = "v{new_version}"
tag_message = "Bump version: {current_version} → {new_version}"
allow_dirty = false
commit = false
message = "Bump version: {current_version} → {new_version}"
commit_args = ""

Visualize the versioning path

You can see the potential versioning paths with the show-bump subcommand.

$ bump-my-version show-bump
0.1.0 ── bump ─┬─ major ─ 1.0.0
               ├─ minor ─ 0.2.0
               ╰─ patch ─ 0.1.1
$ bump-my-version show-bump 1.2.3
1.2.3 ── bump ─┬─ major ─ 2.0.0
               ├─ minor ─ 1.3.0
               ╰─ patch ─ 1.2.4

The default configuration only allows bumping the major, minor, or patch version. What if you wanted to support pre-release versions?

Get the new version in a script

If you want to get the new version within a script, you can use the show method.

$ bump-my-version show current_version
1.2.3
$ bump-my-version show --increment minor new_version
1.3.3

Add support for pre-release versions

Alter the parse configuration to support pre-release versions. This parse option uses an extended (or verbose) regular expression to extract the version components from the current version.

parse = """(?x)
    (?P<major>0|[1-9]\\d*)\\.
    (?P<minor>0|[1-9]\\d*)\\.
    (?P<patch>0|[1-9]\\d*)
    (?:
        -                             # dash separator for pre-release section
        (?P<pre_l>[a-zA-Z-]+)         # pre-release label
        (?P<pre_n>0|[1-9]\\d*)        # pre-release version number
    )?                                # pre-release section is optional
"""

Alter the serialize configuration to support pre-release versions.

serialize = [
    "{major}.{minor}.{patch}-{pre_l}{pre_n}",
    "{major}.{minor}.{patch}",
]

Add a new configuration section for the pre_l part.

[tool.bumpversion.parts.pre_l]
values = ["dev", "rc", "final"]
optional_value = "final"

Visualize the new versioning path

Now when you run bump-my-version show-bump, you can see the new pre-release versioning path.

$ bump-my-version show-bump
0.1.0 ── bump ─┬─ major ─ 1.0.0-dev0
               ├─ minor ─ 0.2.0-dev0
               ├─ patch ─ 0.1.1-dev0
               ├─ pre_l ─ invalid: The part has already the maximum value among ['dev', 'rc', 'final'] and cannot be bumped.
               ╰─ pre_n ─ 0.1.0-final1

The pre_l is not bump-able because it is already at the maximum value. The pre_n is bump-able because it is not at the maximum value.

If we run bump-my-version show-bump 1.0.0-dev0, we can see the new versioning path for a dev starting version.

$ bump-my-version show-bump 1.0.0-dev0
1.0.0-dev0 ── bump ─┬─ major ─ 2.0.0-dev0
                    ├─ minor ─ 1.1.0-dev0
                    ├─ patch ─ 1.0.1-dev0
                    ├─ pre_l ─ 1.0.0-rc0
                    ╰─ pre_n ─ 1.0.0-dev1

Finally, we can see the new versioning path for a rc starting version.

$ bump-my-version show-bump 1.0.0-rc0 
1.0.0-rc0 ── bump ─┬─ major ─ 2.0.0-dev0
                   ├─ minor ─ 1.1.0-dev0
                   ├─ patch ─ 1.0.1-dev0
                   ├─ pre_l ─ 1.0.0
                   ╰─ pre_n ─ 1.0.0-rc1

The full development and release path is:

  • 1.0.0
  • bump patch1.0.1-dev0
  • bump pre_n1.0.1-dev1
  • bump pre_l1.0.1-rc0
  • bump pre_n1.0.1-rc1
  • bump pre_l1.0.1
  1. You must decide on the next version before you start developing.
  2. Development versions increase using bump-my-version bump pre_n.
  3. Switch from development to release candidate using bump-my-version bump pre_l.
  4. Release candidates increase using bump-my-version bump pre_n.
  5. Switch from the release candidate to the final release using bump-my-version bump pre_l.

Automate the pre-release numbering

The pre_n or pre-release number is a number that increases with each pre-release. You can automate this by changing the serialization configuration.

parse = """(?x)
    (?P<major>0|[1-9]\\d*)\\.
    (?P<minor>0|[1-9]\\d*)\\.
    (?P<patch>0|[1-9]\\d*)
    (?:
        -                             # dash separator for pre-release section
        (?P<pre_l>[a-zA-Z-]+)         # pre-release label
        (?:0|[1-9]\\d*)               # pre-release version number
    )?                                # pre-release section is optional
"""

serialize = [
    "{major}.{minor}.{patch}-{pre_l}{distance_to_latest_tag}",
    "{major}.{minor}.{patch}",
]

Now the pre_n is no longer captured in the parse expression and serialize replaces pre_n with distance_to_latest_tag. The distance_to_latest_tag is a special value replaced with the number of commits since the last tag. This is a good value to use for the pre_n because it will always increase with each commit.

Visualize the pre_n versioning path

Now when you run bump-my-version show-bump, you can see the new pre-release versioning path.

$ bump-my-version show-bump
0.1.0 ── bump ─┬─ major ─ 1.0.0-dev0
               ├─ minor ─ 0.2.0-dev0
               ├─ patch ─ 0.1.1-dev0
               ╰─ pre_l ─ invalid: The part has already the maximum value among ['dev', 'rc', 'final'] and cannot be bumped.
$ bump-my-version show-bump 1.0.0-dev0
1.0.0-dev0 ── bump ─┬─ major ─ 2.0.0-dev0
                    ├─ minor ─ 1.1.0-dev0
                    ├─ patch ─ 1.0.1-dev0
                    ╰─ pre_l ─ 1.0.0-rc0
$ bump-my-version show-bump 1.0.0-rc0 
1.0.0-rc0 ── bump ─┬─ major ─ 2.0.0-dev0
                   ├─ minor ─ 1.1.0-dev0
                   ├─ patch ─ 1.0.1-dev0
                   ╰─ pre_l ─ 1.0.0

The pre_n path is now missing because it is automated.

The full development and release path now is:

  • 1.0.0
  • bump patch1.0.1-dev0
    • each commit will increase → 1.0.1-dev1
  • bump pre_l1.0.1-rc0
    • each commit will increase → 1.0.1-rc1
  • bump pre_l1.0.1
  1. You must decide on the next version before you start developing.
  2. Development versions increase automatically with each commit.
  3. Switch from development to release candidate using bump-my-version bump pre_l.
  4. Release candidate versions increase automatically with each commit.
  5. Switch from the release candidate to the final release using bump-my-version bump pre_l.

GitHub Actions

You can use bump-my-version as part of a GHA workflow. Here is an example of a workflow that bumps the version, commits the change, and tags the commit.

name: Bump version

on:
  workflow_dispatch:
    inputs:
      bump-type:
        description: 'Bump type'
        required: true
        default: 'patch'
        type: choice
        options:
        - major
        - minor
        - patch

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout the code
        uses: actions/checkout@v4

      - name: Bump version
        id: bump
        uses: callowayproject/bump-my-version@master
        env:
          BUMPVERSION_TAG: "true"
        with:
          args: ${{ inputs.bump-type }}
          github-token: ${{ secrets.GH_TOKEN }}

      - name: Check
        if: steps.bump.outputs.bumped == 'true'
        run: |
          echo "Version was bumped from ${{ steps.bump.outputs.previous-version }} to ${{ steps.bump.outputs.current-version }}!"

Inputs for the bump-my-version action are:

  1. args - The arguments to pass to the bump-my-version bump [args] command. See the CLI documentation for more information.
  2. github-token - The GitHub token to use for committing and tagging. This is optional.

Output:

  1. bumped - Boolean flag for whether the version was bumped.
  2. previous-version - Version before bump was performed.
  3. current-version - Version after performing bump.

If you want to ensure that workflows set up with on-push trigger will also start based on those newly pushed commits or tags, you need to provide a custom PAT (github-token). See here.

Development & Contributing

Thank you, contributors! You can find a full list here: https://github.com/callowayproject/bump-my-version/graphs/contributors

See also our CONTRIBUTING.md

Development of this happens on GitHub, patches including tests, and documentation are very welcome, as well as bug reports! Please open an issue if this tool does not support every aspect of bumping versions in your development workflow, as it is intended to be very versatile.

License

Bump My Version is licensed under the MIT License - see the LICENSE file for details

1.2.4 Oct 04, 2025
1.2.3 Sep 19, 2025
1.2.2 Sep 13, 2025
1.2.1 Jul 19, 2025
1.2.0 Jun 07, 2025
1.1.4 May 21, 2025
1.1.3 May 17, 2025
1.1.2 Apr 12, 2025
1.1.1 Mar 22, 2025
1.1.0 Mar 22, 2025
1.0.2 Mar 08, 2025
1.0.1 Mar 05, 2025
1.0.0 Mar 02, 2025
0.33.0 Mar 02, 2025
0.32.2 Feb 22, 2025
0.32.1 Feb 10, 2025
0.32.0 Feb 06, 2025
0.31.1 Feb 02, 2025
0.31.0 Feb 01, 2025
0.30.2 Feb 01, 2025
0.30.1 Jan 30, 2025
0.30.0 Jan 26, 2025
0.29.0 Dec 19, 2024
0.28.3 Dec 17, 2024
0.28.2 Dec 16, 2024
0.28.1 Nov 03, 2024
0.28.0 Oct 16, 2024
0.27.0 Oct 06, 2024
0.26.1 Sep 14, 2024
0.26.0 Aug 19, 2024
0.25.4 Aug 14, 2024
0.25.3 Aug 13, 2024
0.25.2 Aug 11, 2024
0.25.1 Aug 07, 2024
0.25.0 Aug 06, 2024
0.24.3 Jul 17, 2024
0.24.2 Jul 03, 2024
0.24.1 Jun 26, 2024
0.24.0 Jun 25, 2024
0.23.0 Jun 14, 2024
0.22.0.post197.dev9 Jun 13, 2024
0.22.0 Jun 11, 2024
0.21.1 May 16, 2024
0.21.0 May 01, 2024
0.20.3 Apr 26, 2024
0.20.2 Apr 23, 2024
0.20.1 Apr 13, 2024
0.20.0 Mar 27, 2024
0.19.3 Mar 23, 2024
0.19.0 Mar 12, 2024
0.18.3 Feb 25, 2024
0.18.2 Feb 25, 2024
0.18.1 Feb 24, 2024
0.17.4 Feb 10, 2024
0.17.3 Jan 29, 2024
0.17.2 Jan 27, 2024
0.17.1 Jan 25, 2024
0.17.0 Jan 22, 2024
0.16.2 Jan 13, 2024
0.16.1 Jan 06, 2024
0.16.0 Jan 05, 2024
0.15.4 Dec 29, 2023
0.15.3 Dec 18, 2023
0.15.2 Dec 18, 2023
0.15.1 Dec 18, 2023
0.15.0 Dec 16, 2023
0.14.0 Dec 16, 2023
0.12.0 Nov 04, 2023
0.11.0 Sep 25, 2023
0.10.0 Sep 05, 2023
0.9.3 Aug 25, 2023
0.9.2 Aug 07, 2023
0.9.1 Aug 03, 2023
0.9.0 Aug 03, 2023
0.8.0 Jul 13, 2023
0.7.1 Jul 12, 2023
0.7.0 Jul 10, 2023
0.6.0 Jun 23, 2023
0.5.1 Jun 14, 2023
0.5.0 Jun 12, 2023
0.4.1 Jun 09, 2023
0.4.0 Apr 20, 2023
0.3.0 Apr 17, 2023
0.2.0 Apr 14, 2023

Wheel compatibility matrix

Platform Python 3
any

Files in release

Extras: None
Dependencies:
click (<8.2.2)
httpx (>=0.28.1)
pydantic-settings
pydantic (>=2.0.0)
questionary
rich
rich-click
tomlkit
wcmatch (>=8.5.1)