Skip to main content

A small command line tool to bump tracked versions in your repository.

Project description

bumpit

A small command line tool to bump tracked versions in your repository.

It is designed to integrate well with your CI/CD pipeline. Simply install and run bumpit as part of your pipeline. Let the robots do the boring work!

Installation

You can download and install bumpit from PyPI by running:

pip install bumpit

Usages

There are two ways to use bumpit

  1. through the command line, or
  2. through your python code

Through CLI

At a high level, you need to

  1. setup the configuration file .bumpconfig.yaml in your target folder.
  2. run bumpit or use in the code

Usage

Usage: bumpit [OPTIONS]

Options:
  -d, --dry-run      Run the tool in dry run mode
  -c, --config TEXT  Configuration settings
  --help             Show this message and exit.

Inside your program

Just do from bumpit.core.bumpit import run in your code.

Check out the bumpit cli code for concrete example.

Configuration

bumpit relies heavily on a configuration file to capture all runtime context of bumpit. This config file is named .bumpconfig.yaml by default. You can override this using the --config option in the command line.

The config file looks like:

current_version: "0.0.1"
strategy: "semver-patch"
tag: True
tag_format: "{version}"
auto_remote_push: True  # or False
tracked_files:
- setup.py

where:

  • current_version - the current version of your files. It needs to be wrapped in quotes to force parsing to be string (e.g. avoid calver current_version to be parsed as float)
  • strategy - supported values semver-major, semver-minor, semver-patch, calver
  • tag - bool value to instruct the tool to tag the repository after the version update
  • tag_format - format of the tag. Some people prefer to add prefix to their tag versions (e.g. release/1.0.1). As long as the {version} is present, then it is a valid tag_format
  • auto_remote_push - bool flag that guards whether to push commit and/or tag changes to remote repository. It should never be wrapped in quotes so that it will be properly parsed as a bool
  • tracked_files - a list of relative filenames to update version to. If the current_version is not found, the tool simply skips this file

Examples

Check out the following repositories for examples:

Version Strategies

The tool currently supports the following versioning strategies

Semantic Version

bumpit implements a very basic semver scheme. It validates the right format using the proposed format.

Notice that semantic version has optional meta tokens after the usual major.minor.patch tokens. When meta token is present and bumpit runs, bumpit naively updates the major.minor.patch version based on the strategy and leaves the meta token as is. If this is not your expected behaviour, please help me understand how it should be handled. You can create an issue and perhaps a PR of your proposed solution.

Calendar Version

bumpit implements a very basic calver scheme. It assumes that the version follows the format YYYYmm.variant where

  • YYYY - year
  • mm - month zero padded
  • variant - incrementing integer to distinguish different version for the same month

When the month rolls over to the next, YYYYmm will be the new month, and variant resets to 1.

The format is quite concrete. This was sufficient enough for my use case. However, if you feel that this is too simplistic, please feel free to create an issue and perhaps a PR of your proposed solution.

Development

Contribution

Code and documentation improvements are all welcome. You can also file bug reports or feature suggestions.

The feature set is meant to handle different versioning strategies. Currently, the strategies I know are applied in the wild are implemented, but it is by no means complete!

Publishing

To publish bumpit, run the following

git checkout master
git pull
bumpit
python setup.py bdist_wheel sdist
twine upload dist/*

License

bumpit is released under the MIT License.

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

bumpit-0.1.0.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bumpit-0.1.0-py3-none-any.whl (13.1 kB view details)

Uploaded Python 3

File details

Details for the file bumpit-0.1.0.tar.gz.

File metadata

  • Download URL: bumpit-0.1.0.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.3

File hashes

Hashes for bumpit-0.1.0.tar.gz
Algorithm Hash digest
SHA256 50407ffeb3e16c61daa1bbf61eddfbe0849f34ca0a0d06484468b9f1c966b105
MD5 67fdc89bc9d4d75f250da9b0cba5c9c7
BLAKE2b-256 79ada30592fcea4994eec184a349471ed420ff4b258037a5396bfa4717ee0cd7

See more details on using hashes here.

File details

Details for the file bumpit-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: bumpit-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.3

File hashes

Hashes for bumpit-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9fde4edf06c99d437f8fe45b715d62e42170c0bf1cd072c6aa41684aa0ff5914
MD5 8acc13432f1eaa33884dd63784277871
BLAKE2b-256 2e4b4daaac510da87637d3d83df89edbfced543ce1fe181194806b93b9ef0fa3

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