Skip to main content

Python version bumper

Project description

Build Code Coverage Version License Python Version
Simple python code to bump kubernetes package manager Helm charts.yaml, VERSION and setup.py files versions.
Version is allowed a lower case ‘v’ character for example: v1.5.4-beta2

Install

pip install pybump

Usage

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

set explicit version or set auto release+metadata:
pybump set --file PATH_TO_CHART.YAML --set-version X.Y.Z [--quiet]

the auto flag is mainly intended for pull request CIs, by using:
pybump set --file PATH_TO_CHART.YAML --auto [--quiet]
pybump will add git commit hash as release info to version
  • NOTE - This can be dangerous as the auto flag might detect a git repo you were not intended to bump, make sure the bumped file is really a child in the git repo you intended to bump.

get current version:
pybump get --file PATH_TO_CHART.YAML

update Helm chart appVersion:
in order to bump/get/set the Helm chart appVersion value just add the --app-version flag
pybump bump [-h] --file PATH_TO_CHART.YAML --level {major,minor,patch} [--quiet] [--app-version]
  • note that the –app-version flag is relevant only for Helm chart.yaml files and has not effect on other cases.

Examples

CLI example

./docs/pybump-recording.gif

CI Usage example

Simple jenkins CI (using k8s plugin) that will use the set –file setup.py –auto options

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)
            }
        }
    }
}
Case: version: 0.0.1
pybump bump --file Chart.yaml --level patch will bump version to 0.0.2

Case: version: 0.1.4-alpha+meta.data
pybump bump --file Chart.yaml --level minor will bump version to 0.2.0-alpha+meta.data

Case: version: v0.0.3
pybump bump --file Chart.yaml --level major will bump version to v1.0.0

Case: version: 0.0.1+some-metadata
pybump set --file Chart.yaml --set-version 1.4.0 will set version to 1.4.0+metadata-here

Case: version: v7.0.2
pybump set --file setup.py --auto will set version to v7.0.2-5a51e0e1d9894d3c5d4201619f10be242320cb59

Case: appVersion 2.3.2
pybump bump --file Chart.yaml --level patch --app-version will bump appVersion to 2.3.3

Case: version: 1.0.13
pybump get --file Chart.yaml will return 1.0.13

Case: version: 1.0.13+some-metadata
pybump get --file Chart.yaml --release will return some

using a container image

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

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.

pybump-1.11.6-py3-none-any.whl (23.3 kB view details)

Uploaded Python 3

File details

Details for the file pybump-1.11.6-py3-none-any.whl.

File metadata

  • Download URL: pybump-1.11.6-py3-none-any.whl
  • Upload date:
  • Size: 23.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for pybump-1.11.6-py3-none-any.whl
Algorithm Hash digest
SHA256 5c4c3622438789a165a8f634828a70fce7fa1f33bb06671fb757cb5c5e4834ce
MD5 58cf8caa3fdeaece04a8ad83758d2cea
BLAKE2b-256 c70a7cdb52e6ed9fd0bd80f99b7ebf0a5da716b4a8b3a48829f5facf03e18f04

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