Updates various version numbers for python projects
Project description
Updates the release numbers for a projects
This script uses the release.ini file placed at the root of the project.
release.ini
[DEFAULT]
current_release = 0.1.0 # Current version of the projects
[main_project]
path = <project>/settings/base.py
# Optional pattern, default is...
pattern = r"^__version__\s*=\s*VERSION\s*=\s*['\"][.\d\w]+['\"]$"
# Optional template, default is...
template = '__version__ = VERSION = "{major}.{minor}.{release}"\n'
[node_module]
path = <project>/assets/package.json
# Optional key, default is...
key = "version"
[sonar]
path = ./sonar-project.properties
# Optional pattern, default is...
pattern = r"^sonar.projectVersion=([.\d]+)$"
# Optional template, default is...
template = "sonar.projectVersion={major}.{minor}\n"
[docs]
path = <project>/../docs/source/conf.py
# Optional pattern, default is...
version_pattern = r"^version\s+=\s+[\"']([.\d]+)[\"']$"
# Optional template, default is...
version_format = 'version = "{major}.{minor}"\n'
# Optional pattern, default is...
release_pattern = r"^release\s+=\s+[\"']([.\d]+)[\"']$"
# Optional template, default is...
release_format = 'release = "{major}.{minor}.{release}"\n'
[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]+)['\"],$"
# Optional template, default is...
template = " version=\"{major}.{minor}.{release}\","
Version numbers that can be updated
- main project version
- node package.json
- sonar properties
- sphinx docs
- ansible variables in a vars file
- setup.py
Installation
$ pip install --user bump-release
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"
...
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
bump_release-0.8.1.tar.gz
(7.1 kB
view hashes)
Built Distribution
Close
Hashes for bump_release-0.8.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e33b2eafce6d3052e76372d4390850668dec2406474683b26959c46c69f5352 |
|
MD5 | 277ff3d5d848d5899c99d9993493e163 |
|
BLAKE2b-256 | 11da1f9b8b94cd82cf3faa4f8e7790f3dd173fd23cb92d9207036e403e899e62 |