Skip to main content

Version-bump your software with a single command!

Project description

b'# bump2version\n\n[![Build Status](https://travis-ci.org/c4urself/bump2version.svg?branch=master)](https://travis-ci.org/c4urself/bump2version)\n\n## NOTE\n\nThis is an interim fork of the excellent project that can be found here: https://github.com/peritus/bumpversion\nUnfortunately it seems like development has been stuck for some time and no activity has been seen from the\nauthor, to that end this project is a drop-in replacement that merges in some of the more important fixes.\nHopefully we can merged back into the original bumpversion and carry on development there.\n\n## Overview\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 creates\ncommits and tags:\n\n* version formats are highly configurable\n* works without any VCS, but happily reads tag information from and writes\n commits and tags to Git and Mercurial if available\n* just handles text files, so it\'s not specific to any programming language\n* supports Python2, Python3 and Pypy\n\n\n## Screencast\n\n<a href="https://asciinema.org/a/3828">Watch a screencast here</a>\n\n## Installation\n\nYou can download and install the latest version of this software from the Python package index (PyPI) as follows::\n\n pip install --upgrade bump2version\n\n## Usage\n\nThere are two modes of operation: On the command line for single-file operation\nand using a configuration file (`bumpversion.cfg`) for more complex multi-file operations.\n\n bump2version [options] part [file]\n\n#### `part`\n _**required**_<br />\n\n The part of the version to increase, e.g. `minor`.\n\n Valid values include those given in the `--serialize` / `--parse` option.\n\n Example bumping 0.5.1 to 0.6.0:\n\n bump2version --current-version 0.5.1 minor src/VERSION\n\n#### `file`\n _**[optional]**_<br />\n **default**: none\n\n The file that will be modified.\n\n If not given, the list of `[bumpversion:file:\xe2\x80\xa6]` sections from the\n configuration file will be used. If no files are mentioned on the\n configuration file either, are no files will be modified.\n\n Example bumping 1.1.9 to 2.0.0:\n\n bump2version --current-version 1.1.9 major setup.py\n\n## Configuration file\n\nAll options can optionally be specified in a config file called\n`.bumpversion.cfg` so that once you know how `bump2version` needs to be\nconfigured for one particular software package, you can run it without\nspecifying options later. You should add that file to VCS so others can also\nbump versions.\n\nOptions on the command line take precedence over those from the config file,\nwhich take precedence over those derived from the environment and then from the\ndefaults.\n\nExample `.bumpversion.cfg`:\n\n [bumpversion]\n current_version = 0.2.9\n commit = True\n tag = True\n\n [bumpversion:file:setup.py]\n\nIf no `.bumpversion.cfg` exists, `bump2version` will also look into\n`setup.cfg` for configuration.\n\n### Configuration file -- Global configuration\n\nGeneral configuration is grouped in a `[bumpversion]` section.\n\n#### `current_version` \n _**required**_<br />\n **default**: none\n\n The current version of the software package before bumping.\n\n Also available as `--current-version` (e.g. `bump2version --current-version 0.5.1 patch setup.py`)\n\n#### `new_version`\n _**[optional]**_<br />\n **default**: none\n\n The version of the software package after the increment. If not given will be\n automatically determined.\n\n Also available as `--new-version` (e.g. `to go from 0.5.1 directly to\n 0.6.1`: `bump2version --current-version 0.5.1 --new-version 0.6.1 patch\n setup.py`).\n\n#### `tag = (True | False)`\n _**[optional]**_<br />\n **default**: False (Don\'t create a tag)\n\n Whether to create a tag, that is the new version, prefixed with the character\n "`v`". If you are using git, don\'t forget to `git-push` with the\n `--tags` flag.\n\n Also available on the command line as `(--tag | --no-tag)`.\n\n#### `sign_tags = (True | False)`\n _**[optional]**_<br />\n **default**: False (Don\'t sign tags)\n\n Whether to sign tags.\n\n Also available on the command line as `(--sign-tags | --no-sign-tags)`.\n\n#### `tag_name =`\n _**[optional]**_<br />\n **default:** `v{new_version}`\n\n The name of the tag that will be created. Only valid when using `--tag` / `tag = True`.\n\n This is templated using the [Python Format String Syntax](http://docs.python.org/2/library/string.html#format-string-syntax)\n Available in the template context are `current_version` and `new_version`\n as well as all environment variables (prefixed with `$`). You can also use\n the variables `now` or `utcnow` to get a current timestamp. Both accept\n datetime formatting (when used like as in `{now:%d.%m.%Y}`).\n\n Also available as a command line flag, `--tag-name` (e.g. `bump2version --message \'Jenkins Build\n {$BUILD_NUMBER}: {new_version}\' patch`).\n\n#### `commit = (True | False)`\n _**[optional]**_<br />\n **default:** False (Don\'t create a commit)\n\n Whether to create a commit using git or Mercurial.\n\n Also available as `(--commit | --no-commit)`.\n\n#### `message =`\n _**[optional]**_<br />\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 using `--commit` / `commit = True`.\n\n This is templated using the [Python Format String Syntax](http://docs.python.org/2/library/string.html#format-string-syntax)\n Available in the template context are `current_version` and `new_version`\n as well as all environment variables (prefixed with `$`). You can also use\n the variables `now` or `utcnow` to get a current timestamp. Both accept\n datetime formatting (when used like as in `{now:%d.%m.%Y}`).\n\n Also available as `--message` (e.g.: `bump2version --message\n \'[{now:%Y-%m-%d}] Jenkins Build {$BUILD_NUMBER}: {new_version}\' patch`)\n\n\n### Configuration file -- 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 `major`, `minor`, `patch`, however you can\ncustomize that using the `parse`/`serialize` option.\n\nBy default all parts considered numeric, that is their initial value is `0`\nand they are increased as integers. Also, the value `0` is considered to be\noptional if it\'s not needed for serialization, i.e. the version `1.4.0` is\nequal to `1.4` if `{major}.{minor}` is given as a `serialize` value.\n\nFor advanced versioning schemes, non-numeric parts may be desirable (e.g. to\nidentify [alpha or beta versions](http://en.wikipedia.org/wiki/Software_release_life_cycle#Stages_of_development)\nto indicate the stage of development, the flavor of the software package or\na release name). To do so, you can use a `[bumpversion:part:\xe2\x80\xa6]` section\ncontaining the part\'s name (e.g. a part named `release_name` is configured in\na section called `[bumpversion: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 specific\n part.\n\n Example::\n\n [bumpversion: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 optional, i.e.\n it\'s representation in a `--serialize` possibility is not required.\n\n Example::\n\n [bumpversion]\n current_version = 1.alpha\n parse = (?P<num>\\d+)\\.(?P<release>.*)\n serialize =\n {num}.{release}\n {num}\n\n [bumpversion:part:release]\n optional_value = gamma\n values =\n alpha\n beta\n gamma\n\n Here, `bump2version release` would bump `1.alpha` to `1.beta`. Executing\n `bump2version release` again would bump `1.beta` to `1`, because\n `release` being `gamma` is configured 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 here.\n\n### Configuration file -- File specific configuration\n\nThis configuration is in the section: `[bumpversion: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 syntax](http://docs.python.org/2/library/re.html#regular-expression-syntax)) on\n how to find and parse the version string.\n\n Is required to parse all strings produced by `serialize =`. Named matching\n groups ("`(?P<name>...)`") provide values to as the `part` 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 version\n string.\n\n This is templated using the [Python Format String Syntax](http://docs.python.org/2/library/string.html#format-string-syntax).\n Available in the template context are parsed values of the named groups\n specified in `parse =` as well as all environment variables (prefixed with\n `$`).\n\n Can be specified multiple times, bumpversion will try the serialization\n formats beginning with the first and choose the last one where all values can\n 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 as\n `1.9`, but the version *2.0* will be serialized as `2`.\n\n Also available as `--serialize`. Multiple values on the command line are\n 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 file.\n Useful if the remotest possibility exists that the current version number\n might be multiple times in the file and you mean to only bump one of the\n occurences. Can be multiple lines, templated using [Python Format String 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 number in\n 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 `.bumpversion.cfg` will ensure only the line containing\n `MyProject` will be changed::\n\n [bumpversion]\n current_version = 1.5.6\n\n [bumpversion:file:requirements.txt]\n search = MyProject=={current_version}\n replace = MyProject=={new_version}\n\n Can be multiple lines, templated using [Python Format String Syntax](http://docs.python.org/2/library/string.html#format-string-syntax).\n\n## Command-line Options\n\nMost of the configuration values above can also be given as an option on the command-line.\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, bumpversion will abort if the working directory is dirty to protect\n yourself from releasing unversioned files and/or overwriting unsaved changes.\n 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## Using bumpversion in a script\n\nIf you need to use the version generated by bumpversion in a script you can make use of\nthe `--list` option, combined with `grep` and `sed`.\n\nSay for example that you are using git-flow to manage your project and want to automatically\ncreate a release. When you issue `git flow release start` you already need to know the\nnew version, before applying the change.\n\nThe standard way to get it in a bash script is\n\n bump2version --dry-run --list <part> | grep <field name> | sed -r s,"^.*=",,\n\nwhere <part> is as usual the part of the version number you are updating. You need to specify\n`--dry-run` to avoid bumpversion actually bumping the version number.\n\nFor example, if you are updating the minor number and looking for the new version number this becomes\n\n bump2version --dry-run --list minor | grep new_version | sed -r s,"^.*=",,\n\n## Development & Contributing\n\nSee also our [CONTRIBUTING.md](CONTRIBUTING.md)\n\nDevelopment of this happens on GitHub, patches including tests, documentation\nare very welcome, as well as bug reports! Also please open an issue if this\ntool does not support every aspect of bumping versions in your development\nworkflow, as it is intended to be very versatile.\n\n### How to release bumpversion itself\n\nExecute the following commands:\n\n git checkout master\n git pull\n make test\n bump2version release\n python setup.py sdist bdist_wheel upload\n bump2version --no-tag patch\n git push origin master --tags\n\n## License\n\nbump2version is licensed under the MIT License - see the LICENSE.rst file for details\n\n## Changes\n\n**unreleased**\n\n**v0.5.8**\n\n- Updated the readme to markdown for easier maintainability\n- Fixed travis testing, thanks: @sharksforarms #15\n- Added support for newlines, thanks; @sharksforarms #14\n- Fixed an issue with a TypeError on Windows, thanks: @lorengordon #12\n- Standardised the python versions, thanks: @ekohl #8\n- Fixed testing for pypy, #7\n\n**v0.5.7**\n\n- Added support for signing tags (git tag -s)\n thanks: @Californian [#6](https://github.com/c4urself/bump2version/pull/6)\n\n**v0.5.6**\n\n- Added compatibility with `bumpversion` by making script install as `bumpversion` as well\n thanks: @the-allanc [#2](https://github.com/c4urself/bump2version/pull/2)\n\n**v0.5.5**\n\n- Added support for annotated tags\n thanks: @ekohl @gvangool [#58](https://github.com/peritus/bumpversion/pull/58)\n\n**v0.5.4**\n\n- Renamed to bump2version to ensure no conflicts with original package\n\n**v0.5.3**\n\n- Fix bug where `--new-version` value was not used when config was present\n (thanks @cscetbon @ecordell [#60](https://github.com/peritus/bumpversion/pull/60)\n- Preserve case of keys config file\n (thanks theskumar [#75](https://github.com/peritus/bumpversion/pull/75)\n- Windows CRLF improvements (thanks @thebjorn)\n\n**v0.5.1**\n\n- Document file specific options `search =` and `replace =` (introduced in 0.5.0)\n- Fix parsing individual labels from `serialize =` config even if there are\n characters after the last label (thanks @mskrajnowski [#56](https://github.com/peritus/bumpversion/pull/56)\n- Fix: Don\'t crash in git repositories that have tags that contain hyphens [#51](https://github.com/peritus/bumpversion/pull/51) and [#52](https://github.com/peritus/bumpversion/pull/52)\n- Fix: Log actual content of the config file, not what ConfigParser prints\n after reading it.\n- Fix: Support multiline values in `search =`\n- also load configuration from `setup.cfg`, thanks @t-8ch [#57](https://github.com/peritus/bumpversion/pull/57)\n\n**v0.5.0**\n\nThis is a major one, containing two larger features, that require some changes\nin the configuration format. This release is fully backwards compatible to\n*v0.4.1*, however deprecates two uses that will be removed in a future version.\n\n- New feature: `Part specific configuration`\n- New feature: `File specific configuration`\n- New feature: parse option can now span multiple line (allows to comment complex\n regular expressions. See re.VERBOSE in the [Python documentation](https://docs.python.org/library/re.html#re.VERBOSE) for details, also see [this testcase](https://github.com/peritus/bumpversion/blob/165e5d8bd308e9b7a1a6d17dba8aec9603f2d063/tests.py#L1202-L1211) as an example.\n- New feature: `--allow-dirty` [#42](https://github.com/peritus/bumpversion/pull/42)\n- Fix: Save the files in binary mode to avoid mutating newlines (thanks @jaraco [#45](https://github.com/peritus/bumpversion/pull/45)\n- License: bumpversion is now licensed under the MIT License [#47](https://github.com/peritus/bumpversion/issues/47)\n- Deprecate multiple files on the command line (use a `configuration file` instead, or invoke `bumpversion` multiple times)\n- Deprecate \'files =\' configuration (use `file specific configuration` instead)\n\n**v0.4.1**\n\n- Add --list option [#39](https://github.com/peritus/bumpversion/issues/39)\n- Use temporary files for handing over commit/tag messages to git/hg [#36](https://github.com/peritus/bumpversion/issues/36)\n- Fix: don\'t encode stdout as utf-8 on py3 [#40](https://github.com/peritus/bumpversion/issues/40)\n- Fix: logging of content of config file was wrong\n\n**v0.4.0**\n\n- Add --verbose option [#21](https://github.com/peritus/bumpversion/issues/21) [#30](https://github.com/peritus/bumpversion/issues/30)\n- Allow option --serialize multiple times\n\n**v0.3.8**\n\n- Fix: --parse/--serialize didn\'t work from cfg [#34](https://github.com/peritus/bumpversion/issues/34)\n\n**v0.3.7**\n\n- Don\'t fail if git or hg is not installed (thanks @keimlink)\n- "files" option is now optional [#16](https://github.com/peritus/bumpversion/issues/16)\n- Fix bug related to dirty work dir [#28](https://github.com/peritus/bumpversion/issues/28)\n\n\n**v0.3.6**\n\n- Fix --tag default (thanks @keimlink)\n\n**v0.3.5**\n\n- add {now} and {utcnow} to context\n- use correct file encoding writing to config file. NOTE: If you are using\n Python2 and want to use UTF-8 encoded characters in your config file, you\n need to update ConfigParser like using \'pip install -U configparser\'\n- leave `current_version` in config even if available from vcs tags (was\n confusing)\n- print own version number in usage\n- allow bumping parts that contain non-numerics\n- various fixes regarding file encoding\n\n**v0.3.4**\n\n- bugfix: tag_name and message in .bumpversion.cfg didn\'t have an effect [#9](https://github.com/peritus/bumpversion/issues/9)\n\n**v0.3.3**\n\n- add --tag-name option\n- now works on Python 3.2, 3.3 and PyPy\n\n**v0.3.2**\n\n- bugfix: Read only tags from `git describe` that look like versions\n\n**v0.3.1**\n\n- bugfix: `--help` in git workdir raising AssertionError\n- bugfix: fail earlier if one of files does not exist\n- bugfix: `commit = True` / `tag = True` in .bumpversion.cfg had no effect\n\n**v0.3.0**\n\n- **BREAKING CHANGE** The `--bump` argument was removed, this is now the first\n positional argument.\n If you used `bumpversion --bump major` before, you can use\n `bumpversion major` now.\n If you used `bumpversion` without arguments before, you now\n need to specify the part (previous default was `patch`) as in\n `bumpversion patch`).\n\n**v0.2.2**\n\n- add --no-commit, --no-tag\n\n**v0.2.1**\n\n- If available, use git to learn about current version\n\n**v0.2.0**\n\n- Mercurial support\n\n**v0.1.1**\n\n- Only create a tag when it\'s requested (thanks @gvangool)\n\n**v0.1.0**\n\n- Initial public version\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

bump2version-0.5.8.tar.gz (40.9 kB view hashes)

Uploaded Source

Built Distribution

bump2version-0.5.8-py2.py3-none-any.whl (25.9 kB view hashes)

Uploaded Python 2 Python 3

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