Version bump your Python project
Project description
Bump My Version
NOTE
This is a maintained refactor of the bump2version fork of the excellent bumpversion project. The main goals of this refactor were:
Overview
Bump My Version's purpose is to:
- Work as a part of an automated build system
- Manage project versioning through the project's development life cycle
- Incrementing version numbers
- serializing version numbers
- parsing version numbers
- Modify project files as part of the project's development life cycle
- Work with the project's source control system
- Committing changes
- Tagging releases
- Reading version numbers from tags
Installation
You can download and install the latest version of this software from the Python package index (PyPI) as follows:
pip install --upgrade bump-my-version
Changelog
Please find the changelog here: CHANGELOG.md
Usage for version incrementing
There are two modes of operation: On the command line for single-file operation and using a configuration file (pyproject.toml
or .bumpversion.toml
) for more complex multi-file operations.
WARNING:
The invocation of
bump-my-version
changed in version 0.6.0. It split functionality into sub-commands. It remains backward-compatible with previous versions. Previous usage is discouraged and may be removed in a 1.0 release.
bump-my-version bump [options] [part] [file]
part
required
The part of the version to increase, e.g. minor
.
Valid values include the named groups defined in the parse
configuration.
Example bumping 0.5.1 to 0.6.0:
bump-my-version bump --current-version 0.5.1 minor
file
[optional]
default: none
Additional files to modify.
These files are added to the list of files specified in your configuration file. If you want to rewrite only files specified on the command line, also use --no-configured-files
.
Example bumping 1.1.9 to 2.0.0:
bump-my-version bump --current-version 1.1.9 major setup.py
Configuration file
bump-my-version
looks in four places for the configuration file to parse (in order of precedence):
--config-file <FILE>
(command line argument)BUMPVERSION_CONFIG_FILE=file
(environment variable).bumpversion.cfg
(legacy).bumpversion.toml
setup.cfg
(legacy)pyproject.toml
.toml
files are recommended due to their type handling. We will likely drop support for ini
-style formats in the future due to issues with formatting and parsing. You should add your configuration file to your source code management system.
By using a configuration file, you no longer need to specify those options on the command line. The configuration file also allows greater flexibility in specifying how files are modified.
Command-line Options
Most of the configuration values above can also be given as an option on the command line. Additionally, the following options are available:
--dry-run, -n
Don't touch any files, just pretend. Best used with --verbose
.
--no-configured-files
Will not update/check files specified in the configuration file.
Similar to dry-run, but will also avoid checking the files. Also useful when you want to update just one file with e.g., bump-my-version --no-configured-files major my-file.txt
--verbose, -v
Print useful information to stderr. If specified more than once, it will output more information.
--list
DEPRECATED. Use bump-my-version show
instead. List machine-readable information to stdout for consumption by other programs.
Example output:
current_version=0.0.18
new_version=0.0.19
-h, --help
Print help and exit
Using Bump My Version in a script
If you need to use the version generated by Bump My Version in a script, you can make use of the show
subcommand.
Say, for example, that you are using git-flow to manage your project and want to automatically create a release. When you issue git flow release start
you need to know the new version before applying the change.
The standard way to get it in a bash script is
bump-my-version show new_version --increment <part>
where part
is the part of the version number you are updating.
For example, if you are updating the minor number and looking for the new version number, this becomes:
$ bump-my-version show new_version --increment minor
1.1.0
Development & Contributing
Thank you, contributors! You can find a full list here: https://github.com/callowayproject/bump-my-version/graphs/contributors
See also our CONTRIBUTING.md
Development of this happens on GitHub, patches including tests, and documentation are very welcome, as well as bug reports! Please open an issue if this tool does not support every aspect of bumping versions in your development workflow, as it is intended to be very versatile.
License
Bump My Version is licensed under the MIT License - see the LICENSE file for details
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for bump_my_version-0.18.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 87ea868304ca91494802cabf191e3da5c1a087aa48669b7af8a99fc746a97911 |
|
MD5 | fb7232630889c052c37719c3ef399d6f |
|
BLAKE2b-256 | c7637aa8c5f0468f15cbe4a1d451d2146b65de1354018f198512cbe1c51c8775 |