version-bumper


Nameversion-bumper JSON
Version 0.1.1 PyPI version JSON
download
home_pageNone
SummaryPython package version utility to bump a version by parts.
upload_time2024-08-29 17:29:06
maintainerNone
docs_urlNone
authorNone
requires_python>=3.11
licenseMIT License Copyright (c) <year> <copyright holders> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords cli application python
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <!--
SPDX-FileCopyrightText: 2024 Roy Wright

SPDX-License-Identifier: MIT
-->

# Version Bumper

[![PyPI - Version](https://img.shields.io/pypi/v/version_bumper.svg)](https://pypi.org/project/version_bumper)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/version_bumper.svg)](https://pypi.org/project/version_bumper)

---

## Table of Contents

<!-- TOC -->

- [Version Bumper](#version-bumper)
  - [Table of Contents](#table-of-contents)
  - [Overview](#overview)
  - [Usage](#usage)
  - [Installation](#installation)
    - [PyPI Installation](#pypi-installation)
    - [Development Installation](#development-installation)
      - [Development Prerequisites](#development-prerequisites)
  - [License](#license)
  - [References](#references)
  <!-- TOC -->

## Overview

Oh, no! Not another version bump utility!

`version_bumper` is a PyPA Version compliant bumper that can bump (increment
by 1) any part of the version and supports pyproject.toml's project.version and
tool.poetry.version key/value pairs.

What this means is:

- `version_bumper` fully complies with the version definition in the Python
  Packaging Authority's (PyPA) (https://www.pypa.io/) Python Packaging User
  Guide
  [Version specifiers](https://packaging.python.org/en/latest/specifications/version-specifiers/#version-specifiers)
  specification (originally PEP440).

- `version_bumper` manages the version(s) in the
  [pyproject.toml](https://packaging.python.org/en/latest/specifications/pyproject-toml/#pyproject-toml-spec)
  file.

  - Poetry uses the key/value pair `tool.poetry.version` (expecting this to
    change when version 2 is released)
  - other tools use the current PyPA standard key/value pair `project.version`
  - `project.version` is required to exist.
  - if `tool.poetry.version` exists, then it will be updated when
    `project.version` is updated.
  - if `tool.poetry.version` does not exist, then `version_bumper` will NOT
    create it.

- `version_bumper` lets you set or bump individual parts of the version as well
  as setting or getting the full version.

- `version_bumper` supports input and output in json, text (for bash scripts),
  or human-readable console.

- `version_bumper` has a full suite (100% coverage) of tests that serve as both
  examples and validation.

## Usage

Let's demonstrate what version_bumper can do.

    ➤ version_bumper
    usage: Version Bumper [-h] [--config FILE] [--save-config] [--save-config-as FILE] [-v] [--longhelp] [--loglevel {DEBUG,INFO,WARNING,ERROR,CRITICAL}] [--debug] [--quiet] [--logfile LOGFILE]
                          {bump,version,set,get,release} ...
    Version Bumper: error: A command argument (set, get, bump, release, version) or an informational option (--help, --longhelp, --version) is required

OK, so we have to give it a command or an informational option. I'll leave the
informational options as an exercise for the reader.

Valid help commands are:

    ➤ version_bumper --help
    ➤ version_bumper set --help
    ➤ version_bumper get --help
    ...

Let's get the version(s):

    ➤ version_bumper get
    project.version: 0.1.1
    tool.poetry.version: 0.1.1

and as json:

    ➤ version_bumper get --json
    {"project.version": "0.1.1", "tool.poetry.version": "0.1.1"}

and as text:

    ➤ version_bumper get --text
    0.1.1
    0.1.1

For getting the version in a bash script, you probably want to specify which
version and get just a single value:

    ➤ PROJECT_VERSION=$(version_bumper get --text --project)
    ➤ echo $PROJECT_VERSION
    0.1.1

Setting the version(s) in the pyproject is simple:

    ➤ version_bumper version "1.2.3a4+54321" --json
    {"version": "1.2.3a4+54321"}

Setting the prerelease part of the version without change any other part:

    ➤ version_bumper set a 5 --json
    {"version": "1.2.3a5+54321"}

Now let's say we want to bump the pre-release (a5):

    ➤ version_bumper bump a --json
    {"version": "1.2.3a6"}

Notice bumping clears everything to the right, unless you are bumping the epoch:

    ➤ version_bumper bump epoch
    version: 1!1.2.3a6

The set command can optional clear everything to the right:

    ➤ version_bumper bump dev
    version: 1!1.2.3a6.dev1
    ➤ version_bumper set local "foo0123"
    version: 1!1.2.3a6.dev1+foo0123
    ➤ version_bumper set minor 4
    version: 1!1.4.3a6.dev1+foo0123
    ➤ version_bumper set minor 5 --clear-right
    version: 1!1.5.0

Let's set the epoch back to 0:

    ➤ version_bumper set epoch 0
    version: 1.5.0

And now make it a release candidate:

    ➤ version_bumper bump rc --json
    {"version": "1.5.0rc1"}

Finally let's make it the release version:

    ➤ version_bumper release --json
    {"version": "1.5.0"}

Please see the unit tests in tests/ directory for more examples.

## Installation

### PyPI Installation

`pip install version_bumper`

### Development Installation

#### Development Prerequisites

- Install the task manager: [Task](https://taskfile.dev/)
- Optionally install [pyenv-installer](https://github.com/pyenv/pyenv-installer)

  - Install dependent pythons, example:

    `pyenv local 3.11.9 3.12.3`

  _Note you may need to install some libraries for the pythons to compile
  cleanly._ _For example on ubuntu (note I prefer `nala` over `apt`):_

  `sudo nala install tk-dev libbz2-dev libreadline-dev libsqlite3-dev lzma-dev python3-tk libreadline-dev`

- Recommended to upgrade pip to latest.
- Optionally install [Poetry](https://python-poetry.org/)
- Optionally install [Hatch](https://hatch.pypa.io/)
- Optionally install [setuptools](https://setuptools.pypa.io/)
  - Install [build](https://build.pypa.io/)

Install the package using your favorite dev tool. Examples:

- `git clone git@github.com:royw/version_bumper.git`
- `cd version_bumper`
- `task init`
- `task build`

_Note, `task init` will run `git init .`, `git add` the initial project files,
and do a `git commit`. If you are using another VCS, please first edit the init
task in the `Taskfile.yaml` file._

See the [Developer README](DEV-README.md) for detailed information on the
development environment.

## License

`version_bumper` is distributed under the terms of the
[MIT](https://spdx.org/licenses/MIT.html) license.

## References

- The [Python Packaging User Guide](https://packaging.python.org/en/latest)
- The
  [pyproject.toml specification](https://pypi.python.org/pypi/pyproject.toml)
- The [Poetry pyproject.toml metadata](https://python-poetry.org/docs/pyproject)
- [pip documentation](https://pip.pypa.io/en/stable/)
- [Setuptools](https://setuptools.pypa.io/)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "version-bumper",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": "Roy Wright <roy@wright.org>",
    "keywords": "CLI, application, python",
    "author": null,
    "author_email": "Roy Wright <roy@wright.org>",
    "download_url": "https://files.pythonhosted.org/packages/fb/0c/be5097c278b3a7a046a958cca3b696113f17bd3fa1e071bc22972ea87c88/version_bumper-0.1.1.tar.gz",
    "platform": null,
    "description": "<!--\nSPDX-FileCopyrightText: 2024 Roy Wright\n\nSPDX-License-Identifier: MIT\n-->\n\n# Version Bumper\n\n[![PyPI - Version](https://img.shields.io/pypi/v/version_bumper.svg)](https://pypi.org/project/version_bumper)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/version_bumper.svg)](https://pypi.org/project/version_bumper)\n\n---\n\n## Table of Contents\n\n<!-- TOC -->\n\n- [Version Bumper](#version-bumper)\n  - [Table of Contents](#table-of-contents)\n  - [Overview](#overview)\n  - [Usage](#usage)\n  - [Installation](#installation)\n    - [PyPI Installation](#pypi-installation)\n    - [Development Installation](#development-installation)\n      - [Development Prerequisites](#development-prerequisites)\n  - [License](#license)\n  - [References](#references)\n  <!-- TOC -->\n\n## Overview\n\nOh, no! Not another version bump utility!\n\n`version_bumper` is a PyPA Version compliant bumper that can bump (increment\nby 1) any part of the version and supports pyproject.toml's project.version and\ntool.poetry.version key/value pairs.\n\nWhat this means is:\n\n- `version_bumper` fully complies with the version definition in the Python\n  Packaging Authority's (PyPA) (https://www.pypa.io/) Python Packaging User\n  Guide\n  [Version specifiers](https://packaging.python.org/en/latest/specifications/version-specifiers/#version-specifiers)\n  specification (originally PEP440).\n\n- `version_bumper` manages the version(s) in the\n  [pyproject.toml](https://packaging.python.org/en/latest/specifications/pyproject-toml/#pyproject-toml-spec)\n  file.\n\n  - Poetry uses the key/value pair `tool.poetry.version` (expecting this to\n    change when version 2 is released)\n  - other tools use the current PyPA standard key/value pair `project.version`\n  - `project.version` is required to exist.\n  - if `tool.poetry.version` exists, then it will be updated when\n    `project.version` is updated.\n  - if `tool.poetry.version` does not exist, then `version_bumper` will NOT\n    create it.\n\n- `version_bumper` lets you set or bump individual parts of the version as well\n  as setting or getting the full version.\n\n- `version_bumper` supports input and output in json, text (for bash scripts),\n  or human-readable console.\n\n- `version_bumper` has a full suite (100% coverage) of tests that serve as both\n  examples and validation.\n\n## Usage\n\nLet's demonstrate what version_bumper can do.\n\n    \u27a4 version_bumper\n    usage: Version Bumper [-h] [--config FILE] [--save-config] [--save-config-as FILE] [-v] [--longhelp] [--loglevel {DEBUG,INFO,WARNING,ERROR,CRITICAL}] [--debug] [--quiet] [--logfile LOGFILE]\n                          {bump,version,set,get,release} ...\n    Version Bumper: error: A command argument (set, get, bump, release, version) or an informational option (--help, --longhelp, --version) is required\n\nOK, so we have to give it a command or an informational option. I'll leave the\ninformational options as an exercise for the reader.\n\nValid help commands are:\n\n    \u27a4 version_bumper --help\n    \u27a4 version_bumper set --help\n    \u27a4 version_bumper get --help\n    ...\n\nLet's get the version(s):\n\n    \u27a4 version_bumper get\n    project.version: 0.1.1\n    tool.poetry.version: 0.1.1\n\nand as json:\n\n    \u27a4 version_bumper get --json\n    {\"project.version\": \"0.1.1\", \"tool.poetry.version\": \"0.1.1\"}\n\nand as text:\n\n    \u27a4 version_bumper get --text\n    0.1.1\n    0.1.1\n\nFor getting the version in a bash script, you probably want to specify which\nversion and get just a single value:\n\n    \u27a4 PROJECT_VERSION=$(version_bumper get --text --project)\n    \u27a4 echo $PROJECT_VERSION\n    0.1.1\n\nSetting the version(s) in the pyproject is simple:\n\n    \u27a4 version_bumper version \"1.2.3a4+54321\" --json\n    {\"version\": \"1.2.3a4+54321\"}\n\nSetting the prerelease part of the version without change any other part:\n\n    \u27a4 version_bumper set a 5 --json\n    {\"version\": \"1.2.3a5+54321\"}\n\nNow let's say we want to bump the pre-release (a5):\n\n    \u27a4 version_bumper bump a --json\n    {\"version\": \"1.2.3a6\"}\n\nNotice bumping clears everything to the right, unless you are bumping the epoch:\n\n    \u27a4 version_bumper bump epoch\n    version: 1!1.2.3a6\n\nThe set command can optional clear everything to the right:\n\n    \u27a4 version_bumper bump dev\n    version: 1!1.2.3a6.dev1\n    \u27a4 version_bumper set local \"foo0123\"\n    version: 1!1.2.3a6.dev1+foo0123\n    \u27a4 version_bumper set minor 4\n    version: 1!1.4.3a6.dev1+foo0123\n    \u27a4 version_bumper set minor 5 --clear-right\n    version: 1!1.5.0\n\nLet's set the epoch back to 0:\n\n    \u27a4 version_bumper set epoch 0\n    version: 1.5.0\n\nAnd now make it a release candidate:\n\n    \u27a4 version_bumper bump rc --json\n    {\"version\": \"1.5.0rc1\"}\n\nFinally let's make it the release version:\n\n    \u27a4 version_bumper release --json\n    {\"version\": \"1.5.0\"}\n\nPlease see the unit tests in tests/ directory for more examples.\n\n## Installation\n\n### PyPI Installation\n\n`pip install version_bumper`\n\n### Development Installation\n\n#### Development Prerequisites\n\n- Install the task manager: [Task](https://taskfile.dev/)\n- Optionally install [pyenv-installer](https://github.com/pyenv/pyenv-installer)\n\n  - Install dependent pythons, example:\n\n    `pyenv local 3.11.9 3.12.3`\n\n  _Note you may need to install some libraries for the pythons to compile\n  cleanly._ _For example on ubuntu (note I prefer `nala` over `apt`):_\n\n  `sudo nala install tk-dev libbz2-dev libreadline-dev libsqlite3-dev lzma-dev python3-tk libreadline-dev`\n\n- Recommended to upgrade pip to latest.\n- Optionally install [Poetry](https://python-poetry.org/)\n- Optionally install [Hatch](https://hatch.pypa.io/)\n- Optionally install [setuptools](https://setuptools.pypa.io/)\n  - Install [build](https://build.pypa.io/)\n\nInstall the package using your favorite dev tool. Examples:\n\n- `git clone git@github.com:royw/version_bumper.git`\n- `cd version_bumper`\n- `task init`\n- `task build`\n\n_Note, `task init` will run `git init .`, `git add` the initial project files,\nand do a `git commit`. If you are using another VCS, please first edit the init\ntask in the `Taskfile.yaml` file._\n\nSee the [Developer README](DEV-README.md) for detailed information on the\ndevelopment environment.\n\n## License\n\n`version_bumper` is distributed under the terms of the\n[MIT](https://spdx.org/licenses/MIT.html) license.\n\n## References\n\n- The [Python Packaging User Guide](https://packaging.python.org/en/latest)\n- The\n  [pyproject.toml specification](https://pypi.python.org/pypi/pyproject.toml)\n- The [Poetry pyproject.toml metadata](https://python-poetry.org/docs/pyproject)\n- [pip documentation](https://pip.pypa.io/en/stable/)\n- [Setuptools](https://setuptools.pypa.io/)\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) <year> <copyright holders>  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "Python package version utility to bump a version by parts.",
    "version": "0.1.1",
    "project_urls": {
        "version_bumper": "https://github.com/royw/version_bumper"
    },
    "split_keywords": [
        "cli",
        " application",
        " python"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3fe8bf92e9d866621c40c73225c5e1f77f7da39bf0b5ef60f098db5c00c4f6ed",
                "md5": "e1aad9cfb63ee06cb6548cf0151b1ef1",
                "sha256": "8b5a6e1f18cfbe27e3a6d4f5c2d379d391f05c4b2dfa182f4eb4702f660fde2b"
            },
            "downloads": -1,
            "filename": "version_bumper-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e1aad9cfb63ee06cb6548cf0151b1ef1",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 26433,
            "upload_time": "2024-08-29T17:29:04",
            "upload_time_iso_8601": "2024-08-29T17:29:04.081203Z",
            "url": "https://files.pythonhosted.org/packages/3f/e8/bf92e9d866621c40c73225c5e1f77f7da39bf0b5ef60f098db5c00c4f6ed/version_bumper-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fb0cbe5097c278b3a7a046a958cca3b696113f17bd3fa1e071bc22972ea87c88",
                "md5": "aa6331fbd823711752fa960ae6dd9f7e",
                "sha256": "baef9cf10b6c7eb291424661a620800480bb3cd1ece01e3207ef2b42799a63a2"
            },
            "downloads": -1,
            "filename": "version_bumper-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "aa6331fbd823711752fa960ae6dd9f7e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 144611,
            "upload_time": "2024-08-29T17:29:06",
            "upload_time_iso_8601": "2024-08-29T17:29:06.542900Z",
            "url": "https://files.pythonhosted.org/packages/fb/0c/be5097c278b3a7a046a958cca3b696113f17bd3fa1e071bc22972ea87c88/version_bumper-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-29 17:29:06",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "royw",
    "github_project": "version_bumper",
    "github_not_found": true,
    "lcname": "version-bumper"
}
        
Elapsed time: 0.63442s