bumpversion2


Namebumpversion2 JSON
Version 1.4.3 PyPI version JSON
download
home_pageNone
SummaryNone
upload_time2024-11-03 20:48:30
maintainerNone
docs_urlNone
authorWaket Zheng
requires_python<4.0,>=3.8
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # bumpversion2

[![image](https://img.shields.io/pypi/v/bumpversion2.svg)](https://pypi.org/project/bumpversion2/)
[![image](https://img.shields.io/pypi/l/bumpversion2.svg)](https://pypi.org/project/bumpversion2/)
[![image](https://img.shields.io/pypi/pyversions/bumpversion2.svg)](https://pypi.org/project/bumpversion2/)
[![GitHub Actions](https://github.com/waketzheng/bumpversion2/workflows/CI/badge.svg)](https://github.com/waketzheng/bumpversion2/actions)

## Fork

As the excellent original projects ([bumpversion](https://github.com/peritus/bumpversion)/[bump2version](https://github.com/c4urself/bump2version)) are no longer maintained.

I make this fork to fix some errors. It would be a pleasure to merge it back to the origins.

## Overview

Version-bump your software with a single command!

A small command line tool to simplify releasing software by updating all
version strings in your source code by the correct increment. Also creates
commits and tags:

* version formats are highly configurable
* works without any VCS, but happily reads tag information from and writes
  commits and tags to Git and Mercurial if available
* just handles text files, so it's not specific to any programming language
* supports Python 3 and PyPy3

If you want to use Python 2, use `pip>=9` and you'll get the last supported version,
or pin `bump2version<1`.

## Alternatives

If bump2version does not fully suit your needs, you could take a look
at other tools doing similar or related tasks:
[ALTERNATIVES.md](https://github.com/c4urself/bump2version/blob/master/RELATED.md).

## Installation

You can download and install the latest version of this software from the Python package index (PyPI) as follows:

    pip install --upgrade bumpversion2

## Changelog

Please find the changelog here: [CHANGELOG.md](CHANGELOG.md)

## Usage

There are two modes of operation: On the command line for single-file operation
and using a configuration file (`.bumpversion.cfg`) for more complex multi-file operations.

    bumpversion [options] part [file]

#### `part`
  _**required**_<br />

  The part of the version to increase, e.g. `minor`.

  Valid values include those given in the `--serialize` / `--parse` option.

  Example bumping 0.5.1 to 0.6.0:

     bumpversion --current-version 0.5.1 minor src/VERSION

#### `file`
  _**[optional]**_<br />
  **default**: none

  The file that will be modified.

  This file is added to the list of files specified in `[bumpversion:file:…]`
  sections from the configuration file. If you want to rewrite only files
  specified on the command line, use `--no-configured-files`.

  Example bumping 1.1.9 to 2.0.0:

     bumpversion --current-version 1.1.9 major setup.py

## Configuration file

All options can optionally be specified in a config file called
`.bumpversion.cfg` so that once you know how `bumpversion` needs to be
configured for one particular software package, you can run it without
specifying options later. You should add that file to VCS so others can also
bump versions.

Options on the command line take precedence over those from the config file,
which take precedence over those derived from the environment and then from the
defaults.

Example `.bumpversion.cfg`:

```ini
[bumpversion]
current_version = 0.2.9
commit = True
tag = True

[bumpversion:file:setup.py]
```

If no `.bumpversion.cfg` exists, `bumpversion` will also look into
`setup.cfg` for configuration.

### Configuration file -- Global configuration

General configuration is grouped in a `[bumpversion]` section.

#### `current_version`
  _**required**_<br />
  **default**: none

  The current version of the software package before bumping.

  Also available as `--current-version` (e.g. `bumpversion --current-version 0.5.1 patch setup.py`)

#### `new_version`
  _**[optional]**_<br />
  **default**: none

  The version of the software package after the increment. If not given will be
  automatically determined.

  Also available as `--new-version` (e.g. `to go from 0.5.1 directly to
  0.6.1`: `bumpversion --current-version 0.5.1 --new-version 0.6.1 patch
  setup.py`).

#### `tag = (True | False)`
  _**[optional]**_<br />
  **default**: False (Don't create a tag)

  Whether to create a tag, that is the new version, prefixed with the character
  "`v`". If you are using git, don't forget to `git-push` with the
  `--tags` flag.

  Also available on the command line as `(--tag | --no-tag)`.

#### `sign_tags = (True | False)`
  _**[optional]**_<br />
  **default**: False (Don't sign tags)

  Whether to sign tags.

  Also available on the command line as `(--sign-tags | --no-sign-tags)`.

#### `tag_name =`
  _**[optional]**_<br />
  **default:** `v{new_version}`

  The name of the tag that will be created. Only valid when using `--tag` / `tag = True`.

  This is templated using the [Python Format String Syntax](https://docs.python.org/3/library/string.html#format-string-syntax).
  Available in the template context are `current_version` and `new_version`
  as well as `current_[part]` and `new_[part]` (e.g. '`current_major`'
  or '`new_patch`').
  In addition, all environment variables are exposed, prefixed with `$`.
  You can also use the variables `now` or `utcnow` to get a current timestamp. Both accept
  datetime formatting (when used like as in `{now:%d.%m.%Y}`).

  Also available as command-line flag `tag-name`.  Example usage:
  `bumpversion --tag-name 'release-{new_version}' patch`

#### `tag_message =`
  _**[optional]**_<br />
  **default:** `Bump version: {current_version} → {new_version}`

  The tag message to use when creating a tag. Only valid when using `--tag` / `tag = True`.

  This is templated using the [Python Format String Syntax](https://docs.python.org/3/library/string.html#format-string-syntax).
  Available in the template context are `current_version` and `new_version`
  as well as `current_[part]` and `new_[part]` (e.g. '`current_major`'
  or '`new_patch`').
  In addition, all environment variables are exposed, prefixed with `$`.
  You can also use the variables `now` or `utcnow` to get a current timestamp. Both accept
  datetime formatting (when used like as in `{now:%d.%m.%Y}`).

  Also available as command-line flag `--tag-message`.  Example usage:
  `bumpversion --tag-message 'Release {new_version}' patch`

  `bumpversion` creates an `annotated` tag in Git by default. To disable this and create a `lightweight` tag, you must explicitly set an empty `tag_message`:

  * either in the configuration file: `tag_message =`
  * or in the command-line: `bumpversion --tag-message ''`

  You can read more about Git tagging [here](https://git-scm.com/book/en/v2/Git-Basics-Tagging).

#### `commit = (True | False)`
  _**[optional]**_<br />
  **default:** False (Don't create a commit)

  Whether to create a commit using git or Mercurial.

  Also available as `(--commit | --no-commit)`.

  In many projects it is common to have a pre-commit hook that runs prior to a
  commit and in case of failure aborts the commit. For some use cases it might
  be desired that when bumping a version and having `commit = True`, the
  pre-commit hook should perform slightly different actions than in regular
  commits. For example run an extended set of checks only for actual releases of
  the software. To allow the pre-commit hooks to distinguish a bumpversion
  commit, the `BUMPVERSION_CURRENT_VERSION` and `BUMPVERSION_NEW_VERSION`
  environment variables are set when executing the commit command.

#### `message =`
  _**[optional]**_<br />
  **default:** `Bump version: {current_version} → {new_version}`

  The commit message to use when creating a commit. Only valid when using `--commit` / `commit = True`.

  This is templated using the [Python Format String Syntax](https://docs.python.org/3/library/string.html#format-string-syntax).
  Available in the template context are `current_version` and `new_version`
  as well as `current_[part]` and `new_[part]` (e.g. '`current_major`'
  or '`new_patch`').
  In addition, all environment variables are exposed, prefixed with `$`.
  You can also use the variables `now` or `utcnow` to get a current timestamp. Both accept
  datetime formatting (when used like as in `{now:%d.%m.%Y}`).

  Also available as command-line flag `--message`.  Example usage:
  `bumpversion --message '[{now:%Y-%m-%d}] Jenkins Build {$BUILD_NUMBER}: {new_version}' patch`)

#### `commit_args =`
  _**[optional]**_<br />
  **default:** empty

  Extra arguments to pass to commit command. Only valid when using `--commit` /
  `commit = True`.

  This is for example useful to add `-s` to generate `Signed-off-by:` line in
  the commit message.

  Multiple arguments can be specified on separate lines.

  Also available as command-line flag `--commit-args`, in which case only one
  argument can be specified.


### Configuration file -- Part specific configuration

A version string consists of one or more parts, e.g. the version `1.0.2`
has three parts, separated by a dot (`.`) character. In the default
configuration these parts are named `major`, `minor`, `patch`, however you can
customize that using the `parse`/`serialize` option.

By default all parts are considered numeric, that is their initial value is `0`
and they are increased as integers. Also, the value `0` is considered to be
optional if it's not needed for serialization, i.e. the version `1.4.0` is
equal to `1.4` if `{major}.{minor}` is given as a `serialize` value.

For advanced versioning schemes, non-numeric parts may be desirable (e.g. to
identify [alpha or beta versions](http://en.wikipedia.org/wiki/Software_release_life_cycle#Stages_of_development)
to indicate the stage of development, the flavor of the software package or
a release name). To do so, you can use a `[bumpversion:part:…]` section
containing the part's name (e.g. a part named `release_name` is configured in
a section called `[bumpversion:part:release_name]`.

The following options are valid inside a part configuration:

#### `values =`
  **default**: numeric (i.e. `0`, `1`, `2`, …)

  Explicit list of all values that will be iterated when bumping that specific
  part.

  Example:

```ini
[bumpversion:part:release_name]
values =
  witty-warthog
  ridiculous-rat
  marvelous-mantis
```

#### `optional_value =`
  **default**: The first entry in `values =`.

  If the value of the part matches this value it is considered optional, i.e.
  its representation in a `--serialize` possibility is not required.

  Example:

```ini
[bumpversion]
current_version = 1.alpha
parse = (?P<num>\d+)(\.(?P<release>.*))?
serialize =
  {num}.{release}
  {num}

[bumpversion:part:release]
optional_value = gamma
values =
  alpha
  beta
  gamma
```

  Here, `bumpversion release` would bump `1.alpha` to `1.beta`. Executing
  `bumpversion release` again would bump `1.beta` to `1`, because
  `release` being `gamma` is configured optional.

  You should consider the version of `1` to technically be `1.gamma`
  with the `.gamma` part not being serialized since it is optional.
  The `{num}` entry in the `serialize` list allows the release part to be
  hidden. If you only had `{num}.{release}`, an optional release will always
  be serialized.

  Attempting to bump the release when it is the value of
  `gamma` will cause a `ValueError` as it will think you are trying to
  exceed the `values` list of the release part.

#### `first_value =`
  **default**: The first entry in `values =`.

  When the part is reset, the value will be set to the value specified here.

  Example:

```ini
[bumpversion]
current_version = 1.alpha1
parse = (?P<num>\d+)(\.(?P<release>.*)(?P<build>\d+))?
serialize =
  {num}.{release}{build}

[bumpversion:part:release]
values =
  alpha
  beta
  gamma

[bumpversion:part:build]
first_value = 1
```

  Here, `bumpversion release` would bump `1.alpha1` to `1.beta1`.

  Without the `first_value = 1` of the build part configured,
  `bumpversion release` would bump `1.alpha1` to `1.beta0`, starting
  the build at `0`.


#### `independent =`
  **default**: `False`

  When this value is set to `True`, the part is not reset when other parts are incremented. Its incrementation is
  independent of the other parts. It is in particular useful when you have a build number in your version that is
  incremented independently of the actual version.

  Example:

```ini
[bumpversion]
current_version: 2.1.6-5123
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)\-(?P<build>\d+)
serialize = {major}.{minor}.{patch}-{build}

[bumpversion:file:VERSION.txt]

[bumpversion:part:build]
independent = True
```

  Here, `bumpversion build` would bump `2.1.6-5123` to `2.1.6-5124`. Executing`bumpversion major`
  would bump `2.1.6-5124` to `3.0.0-5124` without resetting the build number.
  

### Configuration file -- File specific configuration

This configuration is in the section: `[bumpversion:file:…]` or `[bumpversion:glob:…]`

Both, `file:` and `glob:` are configured the same. Their difference is that
file will match file names directly like `requirements.txt`. While glob also
matches multiple files via wildcards like `**/pom.xml`.

Note: The configuration file format requires each section header to be
unique. If you want to process a certain file multiple times,
you may append a description between parens to the `file` keyword:
`[bumpversion:file (special one):…]`.

#### `parse =`
  **default:** `(?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)`

  Regular expression (using [Python regular expression syntax](https://docs.python.org/3/library/re.html#regular-expression-syntax)) on
  how to find and parse the version string.

  Is required to parse all strings produced by `serialize =`. Named matching
  groups ("`(?P<name>...)`") provide values to as the `part` argument.

  Also available as `--parse`

#### `serialize =`
  **default:** `{major}.{minor}.{patch}`

  Template specifying how to serialize the version parts back to a version
  string.

  This is templated using the [Python Format String Syntax](https://docs.python.org/3/library/string.html#format-string-syntax).
  Available in the template context are parsed values of the named groups
  specified in `parse =` as well as all environment variables (prefixed with
  `$`).

  Can be specified multiple times, bumpversion will try the serialization
  formats beginning with the first and choose the last one where all values can
  be represented like this:

```ini
serialize =
  {major}.{minor}
  {major}
```

  Given the example above, the new version `1.9` will be serialized as
  `1.9`, but the version `2.0` will be serialized as `2`.

  Also available as `--serialize`. Multiple values on the command line are
  given like `--serialize {major}.{minor} --serialize {major}`

#### `search =`
  **default:** `{current_version}`

  Template string how to search for the string to be replaced in the file.
  Useful if the remotest possibility exists that the current version number
  might be present multiple times in the file and you mean to only bump one of the
  occurrences. Can be multiple lines, templated using [Python Format String Syntax](https://docs.python.org/3/library/string.html#format-string-syntax)

#### `replace =`
  **default:** `{new_version}`

  Template to create the string that will replace the current version number in
  the file.

  Given this `requirements.txt`:

    Django>=1.5.6,<1.6
    MyProject==1.5.6

  using this `.bumpversion.cfg` will ensure only the line containing
  `MyProject` will be changed:

```ini
[bumpversion]
current_version = 1.5.6

[bumpversion:file:requirements.txt]
search = MyProject=={current_version}
replace = MyProject=={new_version}
```

  Can be multiple lines, templated using [Python Format String Syntax](https://docs.python.org/3/library/string.html#format-string-syntax).

  **NOTE**: (*Updated in v1.0.1*) It is important to point out that if a
  custom search pattern is configured, then `bumpversion` will only perform
  a change if it finds an exact match and will not fallback to the default
  pattern. This is to prevent accidentally changing strings that match the
  default pattern when there is a typo in the custom search pattern.

  For example, if the string to be replaced includes literal quotes,
  the search and replace patterns must include them too to match. Given the
  file `version.sh`:

      MY_VERSION="1.2.3"

  Then the following search and replace patterns (including quotes) would be
  required:

```ini
[bumpversion:file:version.sh]
search = MY_VERSION="{current_version}"
replace = MY_VERSION="{new_version}"
```

## Command-line Options

Most of the configuration values above can also be given as an option on the command-line.
Additionally, the following options are available:

`--dry-run, -n`
  Don't touch any files, just pretend. Best used with `--verbose`.

`--allow-dirty`
  Normally, bumpversion will abort if the working directory is dirty to protect
  yourself from releasing unversioned files and/or overwriting unsaved changes.
  Use this option to override this check.

`--no-configured-files`
  Will not update/check files specified in the .bumpversion.cfg.
  Similar to dry-run, but will also avoid checking the files.
  Also useful when you want to update just one file with e.g.,
    `bumpversion --no-configured-files major my-file.txt`

`--verbose`
  Print useful information to stderr

`--list`
  List machine readable information to stdout for consumption by other
  programs.

  Example output:

    current_version=0.0.18
    new_version=0.0.19

`-h, --help`
  Print help and exit

## Using bumpversion in a script

If you need to use the version generated by bumpversion in a script you can make use of
the `--list` option, combined with `grep` and `sed`.

Say for example that you are using git-flow to manage your project and want to automatically
create a release. When you issue `git flow release start` you already need to know the
new version, before applying the change.

The standard way to get it in a bash script is

    bumpversion --dry-run --list <part> | grep <field name> | sed -r s,"^.*=",,

where `part` is as usual the part of the version number you are updating. You need to specify
`--dry-run` to avoid bumpversion actually bumping the version number.

For example, if you are updating the minor number and looking for the new version number this becomes

    bumpversion --dry-run --list minor | grep new_version | sed -r s,"^.*=",,

## Using bumpversion to maintain a go.mod file within a Go project

In a module-aware Go project, when you create a major version of your module beyond v1, your module name will need
to include the major version # (e.g. `github.com/myorg/myproject/v2`).

You can use bumpversion to maintain the major version # within the go.mod file by using the `parse` and `serialize`
options, as in this example:

- Example `.bumpversion.cfg` file:

```
    [bumpversion]
    current_version = 2.0.0
    commit = True

    [bumpversion:file:go.mod]
    parse = (?P<major>\d+)
    serialize = {major}
    search = module github.com/myorg/myproject/v{current_version}
    replace = module github.com/myorg/myproject/v{new_version}
```

- Example `go.mod` file:

```
    module github.com/myorg/myproject/v2

    go 1.12

    require (
        ...
    )
```

Then run this command to create version 3.0.0 of your project:

```
    bumpversion --new-version 3.0.0 major
```
Your `go.mod` file now contains this module directive:

```
    module github.com/myorg/myproject/v3
```

## Development & Contributing

Thank you contributors! You can find a full list here: https://github.com/c4urself/bumpversion/graphs/contributors

See also our [CONTRIBUTING.md](CONTRIBUTING.md)

Development of this happens on GitHub, patches including tests, documentation
are very welcome, as well as bug reports! Also please open an issue if this
tool does not support every aspect of bumping versions in your development
workflow, as it is intended to be very versatile.

## License

bumpversion2 is licensed under the MIT License - see the [LICENSE.rst](LICENSE.rst) file for details

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "bumpversion2",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.8",
    "maintainer_email": null,
    "keywords": null,
    "author": "Waket Zheng",
    "author_email": "waketzheng@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/6a/0d/e3a5ee68f12fc326cd559ada9a347656def3955ccfd024a4f703857caa07/bumpversion2-1.4.3.tar.gz",
    "platform": null,
    "description": "# bumpversion2\n\n[![image](https://img.shields.io/pypi/v/bumpversion2.svg)](https://pypi.org/project/bumpversion2/)\n[![image](https://img.shields.io/pypi/l/bumpversion2.svg)](https://pypi.org/project/bumpversion2/)\n[![image](https://img.shields.io/pypi/pyversions/bumpversion2.svg)](https://pypi.org/project/bumpversion2/)\n[![GitHub Actions](https://github.com/waketzheng/bumpversion2/workflows/CI/badge.svg)](https://github.com/waketzheng/bumpversion2/actions)\n\n## Fork\n\nAs the excellent original projects ([bumpversion](https://github.com/peritus/bumpversion)/[bump2version](https://github.com/c4urself/bump2version)) are no longer maintained.\n\nI make this fork to fix some errors. It would be a pleasure to merge it back to the origins.\n\n## Overview\n\nVersion-bump your software with a single command!\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 Python 3 and PyPy3\n\nIf you want to use Python 2, use `pip>=9` and you'll get the last supported version,\nor pin `bump2version<1`.\n\n## Alternatives\n\nIf bump2version does not fully suit your needs, you could take a look\nat other tools doing similar or related tasks:\n[ALTERNATIVES.md](https://github.com/c4urself/bump2version/blob/master/RELATED.md).\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 bumpversion2\n\n## Changelog\n\nPlease find the changelog here: [CHANGELOG.md](CHANGELOG.md)\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    bumpversion [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     bumpversion --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  This file is added to the list of files specified in `[bumpversion:file:\u2026]`\n  sections from the configuration file. If you want to rewrite only files\n  specified on the command line, use `--no-configured-files`.\n\n  Example bumping 1.1.9 to 2.0.0:\n\n     bumpversion --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 `bumpversion` 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```ini\n[bumpversion]\ncurrent_version = 0.2.9\ncommit = True\ntag = True\n\n[bumpversion:file:setup.py]\n```\n\nIf no `.bumpversion.cfg` exists, `bumpversion` 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. `bumpversion --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`: `bumpversion --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](https://docs.python.org/3/library/string.html#format-string-syntax).\n  Available in the template context are `current_version` and `new_version`\n  as well as `current_[part]` and `new_[part]` (e.g. '`current_major`'\n  or '`new_patch`').\n  In addition, all environment variables are exposed, prefixed with `$`.\n  You can also use 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 command-line flag `tag-name`.  Example usage:\n  `bumpversion --tag-name 'release-{new_version}' patch`\n\n#### `tag_message =`\n  _**[optional]**_<br />\n  **default:** `Bump version: {current_version} \u2192 {new_version}`\n\n  The tag message to use when creating a tag. Only valid when using `--tag` / `tag = True`.\n\n  This is templated using the [Python Format String Syntax](https://docs.python.org/3/library/string.html#format-string-syntax).\n  Available in the template context are `current_version` and `new_version`\n  as well as `current_[part]` and `new_[part]` (e.g. '`current_major`'\n  or '`new_patch`').\n  In addition, all environment variables are exposed, prefixed with `$`.\n  You can also use 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 command-line flag `--tag-message`.  Example usage:\n  `bumpversion --tag-message 'Release {new_version}' patch`\n\n  `bumpversion` creates an `annotated` tag in Git by default. To disable this and create a `lightweight` tag, you must explicitly set an empty `tag_message`:\n\n  * either in the configuration file: `tag_message =`\n  * or in the command-line: `bumpversion --tag-message ''`\n\n  You can read more about Git tagging [here](https://git-scm.com/book/en/v2/Git-Basics-Tagging).\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  In many projects it is common to have a pre-commit hook that runs prior to a\n  commit and in case of failure aborts the commit. For some use cases it might\n  be desired that when bumping a version and having `commit = True`, the\n  pre-commit hook should perform slightly different actions than in regular\n  commits. For example run an extended set of checks only for actual releases of\n  the software. To allow the pre-commit hooks to distinguish a bumpversion\n  commit, the `BUMPVERSION_CURRENT_VERSION` and `BUMPVERSION_NEW_VERSION`\n  environment variables are set when executing the commit command.\n\n#### `message =`\n  _**[optional]**_<br />\n  **default:** `Bump version: {current_version} \u2192 {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](https://docs.python.org/3/library/string.html#format-string-syntax).\n  Available in the template context are `current_version` and `new_version`\n  as well as `current_[part]` and `new_[part]` (e.g. '`current_major`'\n  or '`new_patch`').\n  In addition, all environment variables are exposed, prefixed with `$`.\n  You can also use 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 command-line flag `--message`.  Example usage:\n  `bumpversion --message '[{now:%Y-%m-%d}] Jenkins Build {$BUILD_NUMBER}: {new_version}' patch`)\n\n#### `commit_args =`\n  _**[optional]**_<br />\n  **default:** empty\n\n  Extra arguments to pass to commit command. Only valid when using `--commit` /\n  `commit = True`.\n\n  This is for example useful to add `-s` to generate `Signed-off-by:` line in\n  the commit message.\n\n  Multiple arguments can be specified on separate lines.\n\n  Also available as command-line flag `--commit-args`, in which case only one\n  argument can be specified.\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 are 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:\u2026]` 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`, \u2026)\n\n  Explicit list of all values that will be iterated when bumping that specific\n  part.\n\n  Example:\n\n```ini\n[bumpversion:part:release_name]\nvalues =\n  witty-warthog\n  ridiculous-rat\n  marvelous-mantis\n```\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  its representation in a `--serialize` possibility is not required.\n\n  Example:\n\n```ini\n[bumpversion]\ncurrent_version = 1.alpha\nparse = (?P<num>\\d+)(\\.(?P<release>.*))?\nserialize =\n  {num}.{release}\n  {num}\n\n[bumpversion:part:release]\noptional_value = gamma\nvalues =\n  alpha\n  beta\n  gamma\n```\n\n  Here, `bumpversion release` would bump `1.alpha` to `1.beta`. Executing\n  `bumpversion release` again would bump `1.beta` to `1`, because\n  `release` being `gamma` is configured optional.\n\n  You should consider the version of `1` to technically be `1.gamma`\n  with the `.gamma` part not being serialized since it is optional.\n  The `{num}` entry in the `serialize` list allows the release part to be\n  hidden. If you only had `{num}.{release}`, an optional release will always\n  be serialized.\n\n  Attempting to bump the release when it is the value of\n  `gamma` will cause a `ValueError` as it will think you are trying to\n  exceed the `values` list of the release part.\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  Example:\n\n```ini\n[bumpversion]\ncurrent_version = 1.alpha1\nparse = (?P<num>\\d+)(\\.(?P<release>.*)(?P<build>\\d+))?\nserialize =\n  {num}.{release}{build}\n\n[bumpversion:part:release]\nvalues =\n  alpha\n  beta\n  gamma\n\n[bumpversion:part:build]\nfirst_value = 1\n```\n\n  Here, `bumpversion release` would bump `1.alpha1` to `1.beta1`.\n\n  Without the `first_value = 1` of the build part configured,\n  `bumpversion release` would bump `1.alpha1` to `1.beta0`, starting\n  the build at `0`.\n\n\n#### `independent =`\n  **default**: `False`\n\n  When this value is set to `True`, the part is not reset when other parts are incremented. Its incrementation is\n  independent of the other parts. It is in particular useful when you have a build number in your version that is\n  incremented independently of the actual version.\n\n  Example:\n\n```ini\n[bumpversion]\ncurrent_version: 2.1.6-5123\nparse = (?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)\\-(?P<build>\\d+)\nserialize = {major}.{minor}.{patch}-{build}\n\n[bumpversion:file:VERSION.txt]\n\n[bumpversion:part:build]\nindependent = True\n```\n\n  Here, `bumpversion build` would bump `2.1.6-5123` to `2.1.6-5124`. Executing`bumpversion major`\n  would bump `2.1.6-5124` to `3.0.0-5124` without resetting the build number.\n  \n\n### Configuration file -- File specific configuration\n\nThis configuration is in the section: `[bumpversion:file:\u2026]` or `[bumpversion:glob:\u2026]`\n\nBoth, `file:` and `glob:` are configured the same. Their difference is that\nfile will match file names directly like `requirements.txt`. While glob also\nmatches multiple files via wildcards like `**/pom.xml`.\n\nNote: The configuration file format requires each section header to be\nunique. If you want to process a certain file multiple times,\nyou may append a description between parens to the `file` keyword:\n`[bumpversion:file (special one):\u2026]`.\n\n#### `parse =`\n  **default:** `(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)`\n\n  Regular expression (using [Python regular expression syntax](https://docs.python.org/3/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](https://docs.python.org/3/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```ini\nserialize =\n  {major}.{minor}\n  {major}\n```\n\n  Given the example above, the new version `1.9` 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 present multiple times in the file and you mean to only bump one of the\n  occurrences. Can be multiple lines, templated using [Python Format String Syntax](https://docs.python.org/3/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```ini\n[bumpversion]\ncurrent_version = 1.5.6\n\n[bumpversion:file:requirements.txt]\nsearch = MyProject=={current_version}\nreplace = MyProject=={new_version}\n```\n\n  Can be multiple lines, templated using [Python Format String Syntax](https://docs.python.org/3/library/string.html#format-string-syntax).\n\n  **NOTE**: (*Updated in v1.0.1*) It is important to point out that if a\n  custom search pattern is configured, then `bumpversion` will only perform\n  a change if it finds an exact match and will not fallback to the default\n  pattern. This is to prevent accidentally changing strings that match the\n  default pattern when there is a typo in the custom search pattern.\n\n  For example, if the string to be replaced includes literal quotes,\n  the search and replace patterns must include them too to match. Given the\n  file `version.sh`:\n\n      MY_VERSION=\"1.2.3\"\n\n  Then the following search and replace patterns (including quotes) would be\n  required:\n\n```ini\n[bumpversion:file:version.sh]\nsearch = MY_VERSION=\"{current_version}\"\nreplace = MY_VERSION=\"{new_version}\"\n```\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`--no-configured-files`\n  Will not update/check files specified in the .bumpversion.cfg.\n  Similar to dry-run, but will also avoid checking the files.\n  Also useful when you want to update just one file with e.g.,\n    `bumpversion --no-configured-files major my-file.txt`\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    bumpversion --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    bumpversion --dry-run --list minor | grep new_version | sed -r s,\"^.*=\",,\n\n## Using bumpversion to maintain a go.mod file within a Go project\n\nIn a module-aware Go project, when you create a major version of your module beyond v1, your module name will need\nto include the major version # (e.g. `github.com/myorg/myproject/v2`).\n\nYou can use bumpversion to maintain the major version # within the go.mod file by using the `parse` and `serialize`\noptions, as in this example:\n\n- Example `.bumpversion.cfg` file:\n\n```\n    [bumpversion]\n    current_version = 2.0.0\n    commit = True\n\n    [bumpversion:file:go.mod]\n    parse = (?P<major>\\d+)\n    serialize = {major}\n    search = module github.com/myorg/myproject/v{current_version}\n    replace = module github.com/myorg/myproject/v{new_version}\n```\n\n- Example `go.mod` file:\n\n```\n    module github.com/myorg/myproject/v2\n\n    go 1.12\n\n    require (\n        ...\n    )\n```\n\nThen run this command to create version 3.0.0 of your project:\n\n```\n    bumpversion --new-version 3.0.0 major\n```\nYour `go.mod` file now contains this module directive:\n\n```\n    module github.com/myorg/myproject/v3\n```\n\n## Development & Contributing\n\nThank you contributors! You can find a full list here: https://github.com/c4urself/bumpversion/graphs/contributors\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## License\n\nbumpversion2 is licensed under the MIT License - see the [LICENSE.rst](LICENSE.rst) file for details\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": null,
    "version": "1.4.3",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "23e015a48e4ced589030b95fe278e25a2cf59beeaca650cf19fcbc4698ca9b34",
                "md5": "658607571a4aa81551e102cb304af675",
                "sha256": "ed0a608c9bca4ebd57e546c925c6e66d8763fbb45b2ee971e0006a65fa7e02e7"
            },
            "downloads": -1,
            "filename": "bumpversion2-1.4.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "658607571a4aa81551e102cb304af675",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8",
            "size": 23464,
            "upload_time": "2024-11-03T20:48:29",
            "upload_time_iso_8601": "2024-11-03T20:48:29.477733Z",
            "url": "https://files.pythonhosted.org/packages/23/e0/15a48e4ced589030b95fe278e25a2cf59beeaca650cf19fcbc4698ca9b34/bumpversion2-1.4.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6a0de3a5ee68f12fc326cd559ada9a347656def3955ccfd024a4f703857caa07",
                "md5": "8f536e2dc8dd4bb34f1b3c9237e34416",
                "sha256": "7dbc3914d775dce7035822d97cd190b2478206a1e02eeb033daf3ffe35e36a51"
            },
            "downloads": -1,
            "filename": "bumpversion2-1.4.3.tar.gz",
            "has_sig": false,
            "md5_digest": "8f536e2dc8dd4bb34f1b3c9237e34416",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8",
            "size": 26861,
            "upload_time": "2024-11-03T20:48:30",
            "upload_time_iso_8601": "2024-11-03T20:48:30.988615Z",
            "url": "https://files.pythonhosted.org/packages/6a/0d/e3a5ee68f12fc326cd559ada9a347656def3955ccfd024a4f703857caa07/bumpversion2-1.4.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-03 20:48:30",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "bumpversion2"
}
        
Elapsed time: 5.21131s