Skip to main content

Version-bump your software with a single command!

Project description

b'# bumpv\n\nA more modern and streamlined fork of [bumpversion](https://github.com/peritus/bumpversion)\n\n\n\nA small command line tool to simplify releasing software by updating all\nversion strings in your source code by the correct increment. Also\ncreates commits and tags:\n\n - version formats are highly configurable\n - works without any VCS, but happily reads tag information from and\n writes commits and tags to Git and Mercurial if available\n - just handles text files, so it\'s not specific to any programming\n language\n\n[![image](https://travis-ci.org/kylie-a/bumpv.png?branch=master)](https://travis-ci.org/peritus/bumpv)\n\n# Installation\n\nYou can download and install the latest version of this software from\nthe Python package index (PyPI) as follows:\n\n pip install --upgrade bumpv\n\n# Usage\n\n`bumpv` can be used as a CLI tool or as installed library as part of a larger CI/CD system.\n\n## CLI\n\n```bash\nbumpv bump [major|minor|patch] [-d | --allow-dirty] \n```\n\n# Configuration\n\nAll options can optionally be specified in a config file called\n`.bumpv.cfg` so that once you know how `bumpv` needs to be configured\nfor one particular software package, you can run it without specifying\noptions later. You should add that file to VCS so others can also bump\nversions.\n\nOptions on the command line take precedence over those from the config\nfile, which take precedence over those derived from the environment and\nthen from the defaults.\n\nExample `.bumpv.cfg`:\n\n [bumpv]\n current_version = 0.2.9\n commit = True\n tag = True\n \n [bumpv:file:setup.py]\n\nIf no `.bumpv.cfg` exists, `bumpv` will also look into `setup.cfg` for\nconfiguration.\n\n# Global configuration\n\nGeneral configuration is grouped in a `[bumpv]` section.\n\n - `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. `bumpv\n --current-version 0.5.1 patch setup.py`)\n\n - `new_version =` \n **no default value** (optional)\n \n The version of the software package after the increment. If not\n given will be automatically determined.\n \n Also available as `--new-version` (e.g. \\`to go from 0.5.1 directly\n to 0.6.8\\`: `bumpv --current-version 0.5.1 --new-version 0.6.8 patch\n setup.py`).\n\n - `tag = (True | False)` \n **default:** False (<span class="title-ref">Don\'t create a\n tag</span>)\n \n Whether to create a tag, that is the new version, prefixed with the\n character "`v`". If you are using git, don\'t forget to `git-push`\n with the `--tags` flag.\n \n Also available on the command line as `(--tag | --no-tag)`.\n\n - `tag_name =` \n **default:** `v{new_version}`\n \n The name of the tag that will be created. Only valid when using\n `--tag` / `tag = True`.\n \n This is templated using the [Python Format String\n Syntax](http://docs.python.org/2/library/string.html#format-string-syntax).\n Available in the template context are `current_version` and\n `new_version` as well as all environment variables (prefixed with\n `$`). You can also use the variables `now` or `utcnow` to get a\n current timestamp. Both accept datetime formatting (when used like\n as in `{now:%d.%m.%Y}`).\n \n Also available as `--tag-name` (e.g. `bumpv --message \'Jenkins Build\n {$BUILD_NUMBER}: {new_version}\' patch`).\n\n - `commit = (True | False)` \n **default:** `False` (<span class="title-ref">Don\'t create a\n commit</span>)\n \n Whether to create a commit using git or Mercurial.\n \n Also available as `(--commit | --no-commit)`.\n\n - `message =` \n **default:** `Bump version: {current_version} \xe2\x86\x92 {new_version}`\n \n The commit message to use when creating a commit. Only valid when\n using `--commit` / `commit = True`.\n \n This is templated using the [Python Format String\n Syntax](http://docs.python.org/2/library/string.html#format-string-syntax).\n Available in the template context are `current_version` and\n `new_version` as well as all environment variables (prefixed with\n `$`). You can also use the variables `now` or `utcnow` to get a\n current timestamp. Both accept datetime formatting (when used like\n as in `{now:%d.%m.%Y}`).\n \n Also available as `--message` (e.g.: `bumpv --message\n \'[{now:%Y-%m-%d}] Jenkins Build {$BUILD_NUMBER}: {new_version}\'\n patch`)\n\n\n# Part specific configuration\n\nA version string consists of one or more parts, e.g. the version `1.0.2`\nhas three parts, separated by a dot (`.`) character. In the default\nconfiguration these parts are named\n<span class="title-ref">major</span>,\n<span class="title-ref">minor</span>,\n<span class="title-ref">patch</span>, however you can customize that\nusing the `parse`/`serialize` option.\n\nBy default all parts considered numeric, that is their initial value is\n`0` and they are increased as integers. Also, the value `0` is\nconsidered to be optional if it\'s not needed for serialization, i.e. the\nversion `1.4.0` is equal to `1.4` if `{major}.{minor}` is given as a\n`serialize` value.\n\nFor advanced versioning schemes, non-numeric parts may be desirable\n(e.g. to identify [alpha or beta\nversions](http://en.wikipedia.org/wiki/Software_release_life_cycle#Stages_of_development),\nto indicate the stage of development, the flavor of the software package\nor a release name). To do so, you can use a `[bumpv:part:\xe2\x80\xa6]` section\ncontaining the part\'s name (e.g. a part named `release_name` is\nconfigured in a section called `[bumpv:part:release_name]`.\n\nThe following options are valid inside a part configuration:\n\n - `values =` \n **default**: numeric (i.e. `0`, `1`, `2`, \xe2\x80\xa6)\n \n Explicit list of all values that will be iterated when bumping that\n specific part.\n \n Example:\n \n [bumpv:part:release_name]\n values =\n witty-warthog\n ridiculous-rat\n marvelous-mantis\n\n - `optional_value =` \n **default**: The first entry in `values =`.\n \n If the value of the part matches this value it is considered\n optional, i.e. it\'s representation in a `--serialize` possibility is\n not required.\n \n Example:\n \n [bumpv]\n current_version = 1.alpha\n parse = (?P<num>\\d+)\\.(?P<release>.*)\n serialize =\n {num}.{release}\n {num}\n \n [bumpv:part:release]\n optional_value = gamma\n values =\n alpha\n beta\n gamma\n \n Here, `bumpv release` would bump `1.alpha` to `1.beta`. Executing\n `bumpv release` again would bump `1.beta` to `1`, because\n <span class="title-ref">release</span> being `gamma` is configured\n optional.\n\n - `first_value =` \n **default**: The first entry in `values =`.\n \n When the part is reset, the value will be set to the value specified\n here.\n\n# File specific configuration\n\n`[bumpv:file:\xe2\x80\xa6]`\n\n - `parse =` \n **default:** `(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)`\n \n Regular expression (using [Python regular expression\n syntax](http://docs.python.org/2/library/re.html#regular-expression-syntax))\n on how to find and parse the version string.\n \n Is required to parse all strings produced by `serialize =`. Named\n matching groups ("`(?P<name>...)`") provide values to as the `part`\n argument.\n \n Also available as `--parse`\n\n - `serialize =` \n **default:** `{major}.{minor}.{patch}`\n \n Template specifying how to serialize the version parts back to a\n version string.\n \n This is templated using the [Python Format String\n Syntax](http://docs.python.org/2/library/string.html#format-string-syntax).\n Available in the template context are parsed values of the named\n groups specified in `parse =` as well as all environment variables\n (prefixed with `$`).\n \n Can be specified multiple times, bumpv will try the serialization\n formats beginning with the first and choose the last one where all\n 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 serialized\n as `1.9`, but the version *2.0* will be serialized as `2`.\n \n Also available as `--serialize`. Multiple values on the command line\n are given like `--serialize {major}.{minor} --serialize {major}`\n\n - `search =` \n **default:** `{current_version}`\n \n Template string how to search for the string to be replaced in the\n file. Useful if the remotest possibility exists that the current\n version number might be multiple times in the file and you mean to\n only bump one of the occurences. Can be multiple lines, templated\n using [Python Format String\n Syntax](http://docs.python.org/2/library/string.html#format-string-syntax).\n\n - `replace =` \n **default:** `{new_version}`\n \n Template to create the string that will replace the current version\n number in the file.\n \n Given this `requirements.txt`:\n \n Django>=1.5.6,<1.6\n MyProject==1.5.6\n \n using this `.bumpv.cfg` will ensure only the line containing\n `MyProject` will be changed:\n \n [bumpv]\n current_version = 1.5.6\n \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 String\n Syntax](http://docs.python.org/2/library/string.html#format-string-syntax).\n\n# Options\n\nMost of the configuration values above can also be given as an option.\nAdditionally, the following options are available:\n\n - `--dry-run, -n`\n Don\'t touch any files, just pretend. Best used with `--verbose`.\n\n - `--allow-dirty`\n Normally, bumpv will abort if the working directory is dirty to\n protect yourself from releasing unversioned files and/or overwriting\n unsaved changes. Use this option to override this check.\n\n - `--verbose`\n Print useful information to stderr\n\n - `--list`\n List machine readable information to stdout for consumption by other\n programs.\n \n Example output:\n \n current_version=0.0.18\n new_version=0.0.19\n\n - `-h, --help`\n Print help and exit\n\n# License\n\nbumpv is licensed under the MIT License - see the LICENSE.rst file for details\n'

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

bumpv-0.3.0.tar.gz (34.3 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page