Skip to main content

Python Version Bumper

Build Code Coverage Version License Python Version

A simple Python script for updating the version in Kubernetes Helm Chart.yaml, VERSION, and pyproject.toml/setup.py files.

  • Ensures version consistency across all files.

  • Enforces Semantic Versioning 2.0.0.

  • Supports an optional lowercase ‘v’ prefix (e.g., v1.5.4-beta2).

./docs/pybump-recording.gif

Installation

To install pybump, run:

pip install pybump

Usage

Bumping Versions

To bump the version:

pybump bump [-h] --file PATH_TO_CHART.YAML --level {major,minor,patch} [--quiet]

Setting Explicit Versions

To set an explicit version or automatically update release metadata:

pybump set --file PATH_TO_CHART.YAML --set-version X.Y.Z [--quiet]

The auto flag is primarily intended for CI/CD pipelines, such as pull request workflows:

pybump set --file PATH_TO_CHART.YAML --auto [--quiet]

When using –auto, pybump appends the Git commit hash as release metadata to the version.

Add –metadata to attach the commit hash as build metadata (+sha) instead of as a release (-sha):

   pybump set --file PATH_TO_CHART.YAML --auto --metadata [--quiet]

* Note - `--metadata` only has meaning together with `--auto`, and is rejected when combined
  with `--set-version`.

* Warning - The `--auto` flag can be risky, as it may detect a Git repository unintentionally.
  Ensure that the target file is part of the correct repository before running this command.

Retrieving the Current Version

To get the current version:

pybump get --file PATH_TO_CHART.YAML

Updating Helm Chart appVersion

To bump, get, or set the appVersion field in a Helm chart, use the --app-version flag:

pybump bump [-h] --file PATH_TO_CHART.YAML --level {major,minor,patch} [--quiet] [--app-version]

Examples

CI Usage example

A simple Jenkins CI pipeline (using the Kubernetes plugin) that utilizes the set --file setup.py --auto option:

String label = "test-bump-ci-runner"
podTemplate(
        label: label,
        containers: [
                containerTemplate(
                        name: 'pybump',
                        image: "arielev/pybump:1.10.2",
                        ttyEnabled: true,
                        command: 'sleep',
                        args: '1d'
                ),
                containerTemplate(
                        name: 'jnlp',
                        image: 'jenkins/inbound-agent:jdk11',
                        ttyEnabled: true
                )
        ]
) {
    node(label) {
        timeout(time: 10, unit: 'MINUTES') {
            ansiColor('xterm') {
                String version = ""
                container('jnlp') {
                    git credentialsId: "credentials_id_here", url: "https://github.com/arielevs/pybump"
                }
                container('pybump') {
                    version = sh(
                            script: "pybump set --file setup.py --auto",
                            returnStdout: true
                    ).trim()
                }
                println(version)
            }
        }
    }
}

Version Bumping Examples

Case: version: 0.0.1

pybump bump --file Chart.yaml --level patch

Result: Version updated to 0.0.2.

Case: version: 0.1.4-alpha+meta.data

pybump bump --file Chart.yaml --level minor

Result: Version updated to 0.2.0-alpha+meta.data.

Case: version: v0.0.3

pybump bump --file Chart.yaml --level major

Result: Version updated to v1.0.0.

Case: version: 0.0.1+some-metadata

pybump set --file Chart.yaml --set-version 1.4.0

Result: Version updated to 1.4.0+metadata-here.

Case: version: v7.0.2

pybump set --file setup.py --auto

Result: Version updated to v7.0.2-5a51e0e1d9894d3c5d4201619f10be242320cb59.

Case: appVersion: 2.3.2

pybump bump --file Chart.yaml --level patch --app-version

Result: appVersion updated to 2.3.3.

Case: version: 1.0.13

pybump get --file Chart.yaml

Result: Returns 1.0.13.

Case: version: 1.0.13+some-metadata

pybump get --file Chart.yaml --release

Result: Returns some.

Using a Container Image

To run pybump within a container:

docker run --rm --volume $(pwd):/tmp -t arielev/pybump set --file /tmp/setup.py --auto

Release files for pybump 1.14.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pybump 1.14.6
File Size Uploaded
pybump-1.14.6.tar.gz 26.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pybump 1.14.6
File Interpreter ABI Platform
pybump-1.14.6-py3-none-any.whl Python 3 none any Details

Total release size: 43.5 kB

Release files / pybump-1.14.6.tar.gz

Download URL pybump-1.14.6.tar.gz
Size 26.7 kB
Tags Source
SHA-256 checksum
How to use checksums
9ea0c3c4078f32a94361a63e99eec7253faf3b7066f03ccf72d7647f64879ae0
BLAKE2b-256 checksum
How to use checksums
e6674a27fd09fe1b5a1598106bd6132fe691f183b8c0732a2d715fc0379b1569
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.17

Release files / pybump-1.14.6-py3-none-any.whl

Download URL pybump-1.14.6-py3-none-any.whl
Size 16.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3c45ff8d645fc6d17bd11172af671accf2bf11cccaaa0eda0e275c6b63942eaf
BLAKE2b-256 checksum
How to use checksums
b36c50971b87746b08611472637b7573cc1c792310159371609d897fe501dcce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.17

Release history Release notifications | RSS feed

This release

1.14.6 This release

2 release files

1.14.5

2 release files

1.14.4

2 release files

1.14.3

2 release files

1.14.2

2 release files

1.13.2

2 release files

1.13.1

2 release files

1.13.0

2 release files

1.12.6

1 release file

1.12.5

1 release file

1.12.4

1 release file

1.12.3

1 release file

1.12.2

1 release file

1.12.1

1 release file

1.12.0

1 release file

1.11.6

1 release file

1.11.5

1 release file

1.11.4

1 release file

1.11.3

1 release file

1.11.2

1 release file

1.11.1

1 release file

1.10.3

1 release file

1.10.2

1 release file

1.10.1

1 release file

1.9.3

1 release file

1.8.1

1 release file

1.7.10

1 release file

1.7.9

1 release file

1.7.8

1 release file

1.7.7

1 release file

1.7.6

1 release file

1.7.5

1 release file

1.7.4

1 release file

1.7.3

1 release file

1.7.2

1 release file

1.7.1

1 release file

1.6.3

1 release file

1.6.2

1 release file

1.6.1

1 release file

1.5.1

1 release file

1.4.2

1 release file

1.4.1

1 release file

1.3.5

1 release file

1.3.4

1 release file

1.3.3

1 release file

1.3.2

1 release file

1.3.1

1 release file

1.2.5

1 release file

1.2.4

1 release file

1.2.3

1 release file

1.2.2

1 release file

1.1.6

2 release files

1.1.5

2 release files

1.1.4

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.0.14

2 release files

1.0.13

2 release files

1.0.12

2 release files

1.0.10

2 release files

1.0.9

2 release files

1.0.8

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

0.1.3

2 release files

0.1.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page