Skip to main content

Automatically increment the project's version number.

Project description

bumper

PyPI - Python Version PyPI PyPI - License pre-commit.ci status

Automatically increment the project's version number.

Heavily inspired by bump2version and bumpversion. While bump-my-version is an excellent modern fork this functionality, I'd like a pared down version of the offered feature set for my personal projects.

Installation

Install from PyPi with your favorite pip invocation, e.g.:

$ pip install sco1-bumper

You can confirm proper installation via the bumper CLI:

$ bumper --help
Usage: bumper [OPTIONS] COMMAND [ARGS]...

Options:
  --help  Show this message and exit.

Commands:
  bump  Bump the requested version component.
  init  Generate a default bumper configuration file.

Configuration

bumper searches for its configuration options first in a .bumper.toml file, then in pyproject.toml; preference is given to whichever configuration is located first.

Required Fields

tool.bumper

  • current_version - The current software version. This is automatically incremented when bumping.
    • NOTE: Only SemVer is supported

tool.bumper.files

  • file - Path to target file relative to the repository root
  • search - Replacement string to search for in the target file. Must contain a {current_version} tag if you want something to happen.

Example Configuration

The basic configuration looks something like the following:

[tool.bumper]
current_version = "0.1.0"

[[tool.bumper.files]]
file = "./pyproject.toml"
search = 'version = "{current_version}"'

Multiple replacements within the same file can also be specified:

[tool.bumper]
current_version = "0.1.0"

[[tool.bumper.files]]
file = "./pyproject.toml"
search = 'version = "{current_version}"'

[[tool.bumper.files]]
file = "./README.md"
search = "sco1-bumper/{current_version}"

[[tool.bumper.files]]
file = "./README.md"
search = "rev: v{current_version}"

CLI

bumper bump

Bump your project's version number using your defined configuration.

$ bumper bump --help
Usage: bumper bump [OPTIONS] BUMP_BY:{major|minor|patch}

  Bump the requested version component.

  If `dry_run` is `True`, the requested diff will be displayed in the terminal
  & no file modifications will take place.

Arguments:
  BUMP_BY:{major|minor|patch}  [required]

Options:
  --dry-run / --no-dry-run  Preview the requested diff.  [default: no-dry-run]
  --help                    Show this message and exit.

bumper init

A small helper to initialize a starter .bumper.toml file that bumps the version field of your project's pyproject.toml file.

NOTE: This starter file is initialized at version 0.1.0, so be sure to update this value with your current version number before using bumper.

$ bumper init --help
Usage: bumper init [OPTIONS]

  Generate a default bumper configuration file.

  If the `--ignore_existing` flag is set, any existing `.bumper.toml` file
  will be overwritten; this action is not reversible. Otherwise, the existing
  configuration will be preserved.

Options:
  --ignore-existing / --no-ignore-existing
                                  [default: no-ignore-existing]
  --help                          Show this message and exit.

Project details


Download files

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

Source Distribution

sco1_bumper-1.0.0.tar.gz (32.4 kB view details)

Uploaded Source

Built Distribution

sco1_bumper-1.0.0-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file sco1_bumper-1.0.0.tar.gz.

File metadata

  • Download URL: sco1_bumper-1.0.0.tar.gz
  • Upload date:
  • Size: 32.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for sco1_bumper-1.0.0.tar.gz
Algorithm Hash digest
SHA256 720f00e2a76d562dd7a12d982fdc056d63f29eefd559c44d77e6e49f9129f345
MD5 91705c25d8e64dd5716a2a5432b01d0a
BLAKE2b-256 2b2d2be0591d6b3ef728e1d00e12af209d12a3ea744ff45f66572ecffdd3b26a

See more details on using hashes here.

File details

Details for the file sco1_bumper-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: sco1_bumper-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for sco1_bumper-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8877b4a48eec61a5aa5c665264b0b31752c7802debc7cfa8b15046d0b59bab5c
MD5 4eaab3c38c0042b1d1c929b09db1edcc
BLAKE2b-256 e826ef25918766cacaee5b13efdfc7ad5e2acb508c1c3725e631256e5fc79065

See more details on using hashes here.

Supported by

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