Install
pip install base-version-checker
Usage
.bumpversion.cfg
This file is highly recommended to get the most out of this tool.
Without it you may get varied mileage from this as a git hook & when using bump2version.
Here's a simplified example. Use version_checker -e ([bumpversion_cfg_example.txt]) for more details
[bumpversion]
current_version = 0.0.3
[bumpversion:file:Readme.md]
search = version_checker-{current_version}-py3-none-any.whl
replace = version_checker-{new_version}-py3-none-any.whl
[bumpversion:file:setup.cfg]
search = version = {current_version}
replace = version = {new_version}
[bumpversion:file:version.txt]
[bumpversion:file:kustomize/base/service.yaml]
[bumpversion:file:openapi-spec.json]
search = "version": "{current_version}"
replace = "version": "{new_version}"
[bumpversion:file:pom.xml]
search = <version>{current_version}</version> <!--this comment helps bumpversion find my (and only my) version!-->
replace = <version>{new_version}</version> <!--this comment helps bumpversion find my (and only my) version!-->
bump version cfg format
This format is driven by bump2version: https://github.com/c4urself/bump2version/blob/master/README.md I cannot assert that search & replace are regex compatibile, I would strongly recommend you stick to the above format.
[bumpversion]: top level of bumpversion cfg, this is the base for version synchronizing etc.{current_version}: the checker & bump2version dryly replace this value with that reported at the top of the cfg{new_version}: only used by bump2version and is replaced by thepartupdate commanded (patch v minor v major)[bumpversion:file:<file>]: section declaring a hardcoded version is present in a particular filesearch: used by the checker and bumper to search for specific text other than the current_versionreplace: used by the bumper only. the raw text to replace thesearchtext
version_checker usage assuming a .bumpversion.cfg
# to run manually
version_checker -h
VERSION_BASE=origin/non-main-branch version_checker
# to see an example .bumpversion.cfg
version_checker --example-config
# to install as pre-push git hook
version_checker -i pre-push
# add & commit your files, push should throw errors if versions not in sync/updated
# the errors should tell you to do something like the following
bump2version patch
bump2version --help
# given an ongoing merge conflict of versions, run the following to auto-resolve
# keeping the higher of the two versions
version_checker --merge
environment variables
A few configurations can be modified by environment variables:
| Environment Variable | Default | Description |
|---|---|---|
| VERSION_BASE | origin/main or origin/master | The base branch/commit to check versions against |
| VERSION_HEAD | HEAD | The current commit to check versions on |
| REPO_PATH | . | The path to the git repo |
| VERSION_FILE | .bumpversion.cfg | The config file with version configs to parse |
| VERSION_REGEX | ([0-9]+\.?){3}?(\-([a-z]+)\.(\d+)) |
The version regex to search for, changes to this have not been tested much |
Metadata
Release files for base-version-checker 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| base_version_checker-0.4.0.tar.gz | 13.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| base_version_checker-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 31.3 kB
Release files / base_version_checker-0.4.0.tar.gz
| Download URL | base_version_checker-0.4.0.tar.gz |
|---|---|
| Size | 13.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2ea6fbe4bd10ae59dd46ca47a3d535353acd5c91b02238c53fceed6f5e7073f1
|
|
BLAKE2b-256 checksum How to use checksums |
856178a8be71f699a95c0620678333c44a2ae50a2fd7b7ce0c4c1f3e5644ee57
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / base_version_checker-0.4.0-py3-none-any.whl
| Download URL | base_version_checker-0.4.0-py3-none-any.whl |
|---|---|
| Size | 17.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
561008b7d775eb080b8e5a8ea08348c27bd6761083c3f937dc2a2a3a4c0176ca
|
|
BLAKE2b-256 checksum How to use checksums |
ff6f546ac998a08fc2eee31aa2c6cd4b812867238c294419f92b5f86cc0e2b96
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|