Skip to main content

pipeline status coverage report

Updates the release numbers for a projects

This script uses the release.ini file placed at the root of the project, and replaces the version or release number in various files.

$ cd <project_root>
$ ls -al
...
release.ini
...
$ bump_release <major>.<minor>.<release>

Installation

Simple install (without pyproject.tml support)

On linux, the best place to install it is for the user:

$ pip install --user bump-release

Assume to have ~/.local/bin in the $PATH.

You can use pipx too for the same purpose:

$ pipx install bump-release

Install with pyproject.tml support

For pyproject.toml, you can use the pipx command:

$ pip install --user bump-release[toml]

or with pipx:

$ pipx install bump-release[toml]

This will install the bump-release package and the toml dependencies:

  • tomli
  • tomli-w

These libs are the one used by setuptools for pyproject.toml file parsing / updating.

Version numbers that can be updated

  • main project version
  • node package.json
  • sonar properties
  • sphinx docs
  • ansible variables in a vars file
  • setup.py
  • setup.cfg
  • pyproject.toml

release.ini

The .ini file provides path, patterns and templates to update files.

If a section is not present, no action if performed for this section.

The application provides some "standard" patterns and templates (aka. the ones I use in my projects). If you provide some patterns and templates, you have to enclose them with double-quotes. Due to configparser limitations, all strings are parsed as raw strings.

The application removes those double-quotes through a :

pattern = config["<section>"].get("pattern") or DEFAULT_PATTERN
pattern = pattern.strip('"')

Example ini file:

[DEFAULT]
; Current version of the projects, will be updated by the script
current_release = 0.1.0

[main_project]
path = <project>/settings/base.py
; Optional pattern, default is...
pattern = "^__version__\s*=\s*VERSION\s*=\s*['\"][.\d\w]+['\"]$"
; Optional template, default is...
template = "__version__ = VERSION = '{major}.{minor}.{release}'"

[node_module]
path = <project>/assets/package.json
; Optional key, default is...
key = "version"

[sonar]
path = ./sonar-project.properties
; Optional pattern, default is...
pattern = "^sonar.projectVersion=([.\d\w]+)$"
; Optional template, default is...
template = "sonar.projectVersion={major}.{minor}"

[docs]
path = <project>/../docs/source/conf.py
; Optional pattern, default is...
version_pattern = "^version\s+=\s+[\"']([.\d\w]+)[\"']$"
; Optional template, default is...
version_format = "version = '{major}.{minor}'"
; Optional pattern, default is...
release_pattern = "^release\s+=\s+[\"']([.\d\w]+)[\"']$"
; Optional template, default is...
release_format = "release = '{major}.{minor}.{release}'"

[ansible]
path = <project>/../ansible/prod/vars/vars.yml
; Optional key - The script searches for the "git" root key, and then for "version" sub-key
key = "git.version"

[setup]
path = <project>/setup.py
; Optional pattern, default is...
pattern = "^\s*version=['\"]([.\d\w]+)['\"],$"
; Optional template, default is...
template = "    version='{major}.{minor}.{release}',"

[setup_cfg]
path = <project>/setup.cfg
; Optional pattern, default is...
pattern = "^version = ([.\d\w]+)$"
; Optional template, default is...
template = "version = {major}.{minor}.{release}"

[pyproject]
path = <project>/pyproject.toml
; Optional key, default is...
key = "project.version"

Usage

$ cd <project_root>
$ cat release.ini
[DEFAULT]
current_release = 0.0.1

[main_project]
path = "foo/__init__.py"

[sonar]
path = "sonar-project.properties"
...

$ cat foo/__init__.py
...
__version__ = VERSION = "0.0.1"
...
$ bump_release 0.0.2
...
$ cat release.ini
[DEFAULT]
current_release = 0.0.2
...
$ cat foo/__init__.py
...
__version__ = VERSION = "0.0.2"
...

Metadata

Release files for bump-release 0.10.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 bump-release 0.10.6
File Size Uploaded Provenance
bump_release-0.10.6.tar.gz 11.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for bump-release 0.10.6
File Interpreter ABI Platform
bump_release-0.10.6-py3-none-any.whl Python 3 none any Details

Total release size: 21.5 kB

Release files / bump_release-0.10.6.tar.gz

Download URL bump_release-0.10.6.tar.gz
Size 11.0 kB
Tags Source
SHA-256 checksum
How to use checksums
5c5aaeac0bc1e54ecce98ed415e112670faabe7aae689477c5d5d4ceaef11c0a
BLAKE2b-256 checksum
How to use checksums
91f89ada3b865dfc082e1fd9ae6698a357d58d71f56493abc553821c3592f312
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Release files / bump_release-0.10.6-py3-none-any.whl

Download URL bump_release-0.10.6-py3-none-any.whl
Size 10.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d1e2dad0deb967ad0c97e9848f3bcfb165a0bddd03f4b22d4bf032f311f2e7e0
BLAKE2b-256 checksum
How to use checksums
6233c83c43a309d3eea6b11380b09ff30ba0e6a4b12d22d9633233439055cac4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Security for bump-release 0.10.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

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