Skip to main content

Version-bump your software with a single command!

Project description

b’# bumpvnnA more modern and streamlined fork of [bumpversion]( small command line tool to simplify releasing software by updating allnversion strings in your source code by the correct increment. Alsoncreates commits and tags:nn - version formats are highly configurablen - works without any VCS, but happily reads tag information from andn writes commits and tags to Git and Mercurial if availablen - just handles text files, so it’s not specific to any programmingn languagenn[![image](]( InstallationnnYou can download and install the latest version of this software fromnthe Python package index (PyPI) as follows:nn pip install –upgrade bumpvnn# Usagenn`bumpv` can be used as a CLI tool or as installed library as part of a larger CI/CD system.nn## CLInn```bashnbumpv bump [major|minor|patch] [-d | –allow-dirty] n```nn# ConfigurationnnAll options can optionally be specified in a config file calledn`.bumpv.cfg` so that once you know how bumpv needs to be configurednfor one particular software package, you can run it without specifyingnoptions later. You should add that file to VCS so others can also bumpnversions.nnOptions on the command line take precedence over those from the confignfile, which take precedence over those derived from the environment andnthen from the defaults.nnExample .bumpv.cfg:nn [bumpv]n current_version = 0.2.9n commit = Truen tag = Truen n []nnIf no .bumpv.cfg exists, bumpv will also look into setup.cfg fornconfiguration.nn# Global configurationnnGeneral configuration is grouped in a [bumpv] section.nn - current_version = n no default value (required)n n The current version of the software package before bumping.n n Also available as –current-version (e.g. bumpvn –current-version 0.5.1 patch - new_version = n no default value (optional)n n The version of the software package after the increment. If notn given will be automatically determined.n n Also available as –new-version (e.g. `to go from 0.5.1 directlyn to 0.6.8`: bumpv –current-version 0.5.1 –new-version 0.6.8 patchn - tag = (True | False) n default: False (<span class=”title-ref”>Don’t create an tag</span>)n n Whether to create a tag, that is the new version, prefixed with then character “v”. If you are using git, don’t forget to git-pushn with the –tags flag.n n Also available on the command line as (–tag | –no-tag).nn - tag_name = n default: v{new_version}n n The name of the tag that will be created. Only valid when usingn –tag / tag = True.n n This is templated using the [Python Format Stringn Syntax]( Available in the template context are current_version andn new_version as well as all environment variables (prefixed withn $). You can also use the variables now or utcnow to get an current timestamp. Both accept datetime formatting (when used liken as in {now:%d.%m.%Y}).n n Also available as –tag-name (e.g. bumpv –message ‘Jenkins Buildn {$BUILD_NUMBER}: {new_version}’ patch).nn - commit = (True | False) n default: False (<span class=”title-ref”>Don’t create an commit</span>)n n Whether to create a commit using git or Mercurial.n n Also available as (–commit | –no-commit).nn - message = n default: Bump version: {current_version} xe2x86x92 {new_version}n n The commit message to use when creating a commit. Only valid whenn using –commit / commit = True.n n This is templated using the [Python Format Stringn Syntax]( Available in the template context are current_version andn new_version as well as all environment variables (prefixed withn $). You can also use the variables now or utcnow to get an current timestamp. Both accept datetime formatting (when used liken as in {now:%d.%m.%Y}).n n Also available as –message (e.g.: bumpv –messagen ‘[{now:%Y-%m-%d}] Jenkins Build {$BUILD_NUMBER}: {new_version}’n patch)nnn# Part specific configurationnnA version string consists of one or more parts, e.g. the version 1.0.2nhas three parts, separated by a dot (.) character. In the defaultnconfiguration these parts are namedn<span class=”title-ref”>major</span>,n<span class=”title-ref”>minor</span>,n<span class=”title-ref”>patch</span>, however you can customize thatnusing the parse/serialize option.nnBy default all parts considered numeric, that is their initial value isn`0` and they are increased as integers. Also, the value 0 isnconsidered to be optional if it’s not needed for serialization, i.e. thenversion 1.4.0 is equal to 1.4 if {major}.{minor} is given as an`serialize` value.nnFor advanced versioning schemes, non-numeric parts may be desirablen(e.g. to identify [alpha or betanversions](,nto indicate the stage of development, the flavor of the software packagenor a release name). To do so, you can use a [bumpv:part:xe2x80xa6] sectionncontaining the part’s name (e.g. a part named release_name isnconfigured in a section called [bumpv:part:release_name].nnThe following options are valid inside a part configuration:nn - values = n default: numeric (i.e. 0, 1, 2, xe2x80xa6)n n Explicit list of all values that will be iterated when bumping thatn specific part.n n Example:n n [bumpv:part:release_name]n values =n witty-warthogn ridiculous-ratn marvelous-mantisnn - optional_value = n default: The first entry in values =.n n If the value of the part matches this value it is consideredn optional, i.e. it’s representation in a –serialize possibility isn not required.n n Example:n n [bumpv]n current_version = 1.alphan parse = (?P<num>\d+).(?P<release>.*)n serialize =n {num}.{release}n {num}n n [bumpv:part:release]n optional_value = gamman values =n alphan betan gamman n Here, bumpv release would bump 1.alpha to 1.beta. Executingn bumpv release again would bump 1.beta to 1, becausen <span class=”title-ref”>release</span> being gamma is configuredn optional.nn - first_value = n default: The first entry in values =.n n When the part is reset, the value will be set to the value specifiedn here.nn# File specific configurationnn`[bumpv:file:xe2x80xa6]`nn - parse = n default: (?P<major>\d+).(?P<minor>\d+).(?P<patch>\d+)n n Regular expression (using [Python regular expressionn syntax]( on how to find and parse the version string.n n Is required to parse all strings produced by serialize =. Namedn matching groups (“(?P<name>…)”) provide values to as the partn argument.n n Also available as –parsenn - serialize = n default: {major}.{minor}.{patch}n n Template specifying how to serialize the version parts back to an version string.n n This is templated using the [Python Format Stringn Syntax]( Available in the template context are parsed values of the namedn groups specified in parse = as well as all environment variablesn (prefixed with $).n n Can be specified multiple times, bumpv will try the serializationn formats beginning with the first and choose the last one where alln values can be represented like this:n n serialize =n {major}.{minor}n {major}n n Given the example above, the new version 1.9 it will be serializedn as 1.9, but the version 2.0 will be serialized as 2.n n Also available as –serialize. Multiple values on the command linen are given like –serialize {major}.{minor} –serialize {major}nn - search = n default: {current_version}n n Template string how to search for the string to be replaced in then file. Useful if the remotest possibility exists that the currentn version number might be multiple times in the file and you mean ton only bump one of the occurences. Can be multiple lines, templatedn using [Python Format Stringn Syntax]( - replace = n default: {new_version}n n Template to create the string that will replace the current versionn number in the file.n n Given this requirements.txt:n n Django>=1.5.6,<1.6n MyProject==1.5.6n n using this .bumpv.cfg will ensure only the line containingn MyProject will be changed:n n [bumpv]n current_version = 1.5.6n n [bumpv:file:requirements.txt]n search = MyProject=={current_version}n replace = MyProject=={new_version}n n Can be multiple lines, templated using [Python Format Stringn Syntax]( OptionsnnMost of the configuration values above can also be given as an option.nAdditionally, the following options are available:nn - –dry-run, -nn Don’t touch any files, just pretend. Best used with –verbose.nn - –allow-dirtyn Normally, bumpv will abort if the working directory is dirty ton protect yourself from releasing unversioned files and/or overwritingn unsaved changes. Use this option to override this check.nn - –verbosen Print useful information to stderrnn - –listn List machine readable information to stdout for consumption by othern programs.n n Example output:n n current_version=0.0.18n new_version=0.0.19nn - -h, –helpn Print help and exitnn# Licensennbumpv is licensed under the MIT License - see the LICENSE.rst file for detailsn’

Project details

Download files

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

Files for bumpv, version 0.3.0
Filename, size File type Python version Upload date Hashes
Filename, size bumpv-0.3.0.tar.gz (34.3 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page