Name | newversion JSON |
Version |
3.1.0
JSON |
| download |
home_page | None |
Summary | PEP 440 version manager |
upload_time | 2024-11-10 00:52:40 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.9 |
license | MIT License Copyright (c) 2024 Vlad Emelianov 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 |
version
pep440
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# NewVersion - PEP 440 version manager
[![PyPI - newversion](https://img.shields.io/pypi/v/newversion.svg?color=blue&label=newversion)](https://pypi.org/project/newversion)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/newversion.svg?color=blue)](https://pypi.org/project/newversion)
[![PyPI - Downloads](https://static.pepy.tech/badge/newversion)](https://pepy.tech/project/newversion)
[![Docs](https://img.shields.io/readthedocs/newversion.svg?color=blue&label=Docs)](https://newversion.readthedocs.io/)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/newversion.svg?color=blue)](https://pypi.org/project/newversion)
[![Coverage](https://img.shields.io/codecov/c/github/vemel/newversion)](https://codecov.io/gh/vemel/newversion)
- [NewVersion - PEP 440 version manager](#newversion---pep-440-version-manager)
- [Features](#features)
- [Installation](#installation)
- [Usage](#usage)
- [uv](#uv)
- [CLI](#cli)
- [Python library](#python-library)
- [Versioning](#versioning)
- [Latest changes](#latest-changes)
## Features
- Follows [PEP 440](https://www.python.org/dev/peps/pep-0440/)
- Fully compatible with [packaging.Version](https://packaging.pypa.io/en/latest/version.html)
- Brings version bumping from [semver](https://pypi.org/project/semver/)
- Comes with a helpful CLI tool `newversion`
- Shines in CI
## Installation
```bash
python -m pip install newversion
```
## Usage
### uv
```bash
# bump Python package micro version and update package version
# 1.2.3 -> 1.2.4
uvx newversion -p bump --save
# bump Python package minor version and update package version
# 1.2.3 -> 1.3.0
uvx newversion -p bump minor --save
# bump Python package major version and update package version
# 1.2.3 -> 2.0.0
uvx newversion -p bump major --save
# bump Python package RC pre-release version and update package version
# 1.2.3 -> 1.2.4rc1
uvx newversion -p bump pre --save
# set commit hash as local and update package version
# 1.2.3 -> 1.2.3+956a81a
uvx newversion -p set local ${COMMIT_SHA} --save
```
### CLI
```bash
newversion # 0.0.0
newversion bump major # 1.0.0
# get package version from pyproject.toml, setup.cfg or setup.py
newversion -p # 1.2.3
newversion -p bump # 1.2.4
newversion -p bump pre # 1.2.4rc1
newversion -p get minor # 2
# bump minor version and update package version
newversion -p --save bump minor
echo "1.2.3rc1" | newversion bump micro # 1.2.3
echo "1.2.3rc1" | newversion bump minor # 1.3.0
echo "1.2.3rc1" | newversion bump major # 2.0.0
echo "1.2.3rc1" | newversion bump pre # 1.2.3rc2
echo "1.2.3rc1" | newversion bump rc # 1.2.3rc2
echo "1.2.3rc1" | newversion bump alpha # 1.2.4a1
echo "1.2.3rc1" | newversion set micro 5 # 1.2.5rc1
echo "1.2.3rc1" | newversion set minor 5 # 1.5.3rc1
echo "1.2.3rc1" | newversion set major 5 # 5.2.3rc1
echo "1.2.3rc1" | newversion set pre 5 # 1.2.3rc5
echo "1.2.3rc1" | newversion set rc 5 # 1.2.3rc5
echo "1.2.3rc1" | newversion set alpha 5 # 1.2.3a5
echo "1.2.3rc1" | newversion get micro # 1
echo "1.2.3rc1" | newversion get minor # 2
echo "1.2.3rc1" | newversion get major # 3
echo "1.2.3rc1" | newversion get pre # rc1
echo "1.2.3rc1" | newversion get rc # 1
echo "1.2.3rc1" | newversion get alpha # 0
echo "1.2.3rc1" | newversion stable # 1.2.3
echo "1.2.3rc1" | newversion is_stable # error!
echo "1.2.3" | newversion is_stable # 1.2.3
echo "1.2.3" | newversion is_stable && echo "Stable!" # Stable!
echo "1.2.3rc1" | newversion gt "1.2.3" # error!
echo "1.2.3rc1" | newversion lte "1.2.3" # "1.2.3rc1"
```
### Python library
```python
from newversion import Version
version = Version("1.2.3")
next_version = version.bump_minor() # Version("1.3.0")
# bump version same way as SemVer
version.dumps() # "1.2.3"
version.bump_micro().dumps() # "1.2.4"
version.bump_minor().dumps() # "1.3.0"
version.bump_major().dumps() # "2.0.0"
# create and bump pre-releases
version.bump_prerelease().dumps() # "1.2.4rc1"
version.bump_prerelease(bump_release="minor").dumps() # "1.3.0rc1"
version.bump_prerelease("alpha").dumps() # "1.2.4a1"
Version("1.2.3b4").bump_prerelease().dumps() # "1.2.3b5"
version.bump_micro().replace(dev=1234).dumps() # "1.2.4.dev1234"
# and post-releases
version.bump_postrelease().dumps() # "1.2.3.post1"
Version("1.2.3.post3").bump_postrelease(2).dumps() # "1.2.3.post5"
# easily check if this is a pre- or dev release or a stable version
Version("1.2.3").is_stable # True
Version("1.2.3a6").is_stable # False
Version("1.2.3.post3").is_stable # True
Version("1.2.3.post3").get_stable().dumps() # "1.2.3"
```
## Versioning
`newversion` version follows [PEP 440](https://www.python.org/dev/peps/pep-0440/).
## Latest changes
Full changelog can be found in [Releases](https://github.com/vemel/newversion/releases).
Raw data
{
"_id": null,
"home_page": null,
"name": "newversion",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "version, pep440",
"author": null,
"author_email": "Vlad Emelianov <vlad.emelianov.nz@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/94/93/28a56a8c05df3bf722ea47938d1725e731ceb0ab89ae23bfed25bf01a856/newversion-3.1.0.tar.gz",
"platform": null,
"description": "# NewVersion - PEP 440 version manager\n\n[![PyPI - newversion](https://img.shields.io/pypi/v/newversion.svg?color=blue&label=newversion)](https://pypi.org/project/newversion)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/newversion.svg?color=blue)](https://pypi.org/project/newversion)\n[![PyPI - Downloads](https://static.pepy.tech/badge/newversion)](https://pepy.tech/project/newversion)\n[![Docs](https://img.shields.io/readthedocs/newversion.svg?color=blue&label=Docs)](https://newversion.readthedocs.io/)\n\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/newversion.svg?color=blue)](https://pypi.org/project/newversion)\n[![Coverage](https://img.shields.io/codecov/c/github/vemel/newversion)](https://codecov.io/gh/vemel/newversion)\n\n- [NewVersion - PEP 440 version manager](#newversion---pep-440-version-manager)\n - [Features](#features)\n - [Installation](#installation)\n - [Usage](#usage)\n - [uv](#uv)\n - [CLI](#cli)\n - [Python library](#python-library)\n - [Versioning](#versioning)\n - [Latest changes](#latest-changes)\n\n## Features\n\n- Follows [PEP 440](https://www.python.org/dev/peps/pep-0440/)\n- Fully compatible with [packaging.Version](https://packaging.pypa.io/en/latest/version.html)\n- Brings version bumping from [semver](https://pypi.org/project/semver/)\n- Comes with a helpful CLI tool `newversion`\n- Shines in CI\n\n## Installation\n\n```bash\npython -m pip install newversion\n```\n\n## Usage\n\n### uv\n\n```bash\n# bump Python package micro version and update package version\n# 1.2.3 -> 1.2.4\nuvx newversion -p bump --save\n\n# bump Python package minor version and update package version\n# 1.2.3 -> 1.3.0\nuvx newversion -p bump minor --save\n\n# bump Python package major version and update package version\n# 1.2.3 -> 2.0.0\nuvx newversion -p bump major --save\n\n# bump Python package RC pre-release version and update package version\n# 1.2.3 -> 1.2.4rc1\nuvx newversion -p bump pre --save\n\n# set commit hash as local and update package version\n# 1.2.3 -> 1.2.3+956a81a\nuvx newversion -p set local ${COMMIT_SHA} --save\n```\n\n### CLI\n\n```bash\nnewversion # 0.0.0\nnewversion bump major # 1.0.0\n\n# get package version from pyproject.toml, setup.cfg or setup.py\nnewversion -p # 1.2.3\nnewversion -p bump # 1.2.4\nnewversion -p bump pre # 1.2.4rc1\nnewversion -p get minor # 2\n\n\n# bump minor version and update package version\nnewversion -p --save bump minor\n\necho \"1.2.3rc1\" | newversion bump micro # 1.2.3\necho \"1.2.3rc1\" | newversion bump minor # 1.3.0\necho \"1.2.3rc1\" | newversion bump major # 2.0.0\necho \"1.2.3rc1\" | newversion bump pre # 1.2.3rc2\necho \"1.2.3rc1\" | newversion bump rc # 1.2.3rc2\necho \"1.2.3rc1\" | newversion bump alpha # 1.2.4a1\n\necho \"1.2.3rc1\" | newversion set micro 5 # 1.2.5rc1\necho \"1.2.3rc1\" | newversion set minor 5 # 1.5.3rc1\necho \"1.2.3rc1\" | newversion set major 5 # 5.2.3rc1\necho \"1.2.3rc1\" | newversion set pre 5 # 1.2.3rc5\necho \"1.2.3rc1\" | newversion set rc 5 # 1.2.3rc5\necho \"1.2.3rc1\" | newversion set alpha 5 # 1.2.3a5\n\necho \"1.2.3rc1\" | newversion get micro # 1\necho \"1.2.3rc1\" | newversion get minor # 2\necho \"1.2.3rc1\" | newversion get major # 3\necho \"1.2.3rc1\" | newversion get pre # rc1\necho \"1.2.3rc1\" | newversion get rc # 1\necho \"1.2.3rc1\" | newversion get alpha # 0\n\necho \"1.2.3rc1\" | newversion stable # 1.2.3\n\necho \"1.2.3rc1\" | newversion is_stable # error!\necho \"1.2.3\" | newversion is_stable # 1.2.3\necho \"1.2.3\" | newversion is_stable && echo \"Stable!\" # Stable!\n\necho \"1.2.3rc1\" | newversion gt \"1.2.3\" # error!\necho \"1.2.3rc1\" | newversion lte \"1.2.3\" # \"1.2.3rc1\"\n```\n\n### Python library\n\n```python\nfrom newversion import Version\n\nversion = Version(\"1.2.3\")\nnext_version = version.bump_minor() # Version(\"1.3.0\")\n\n# bump version same way as SemVer\nversion.dumps() # \"1.2.3\"\nversion.bump_micro().dumps() # \"1.2.4\"\nversion.bump_minor().dumps() # \"1.3.0\"\nversion.bump_major().dumps() # \"2.0.0\"\n\n# create and bump pre-releases\nversion.bump_prerelease().dumps() # \"1.2.4rc1\"\nversion.bump_prerelease(bump_release=\"minor\").dumps() # \"1.3.0rc1\"\nversion.bump_prerelease(\"alpha\").dumps() # \"1.2.4a1\"\nVersion(\"1.2.3b4\").bump_prerelease().dumps() # \"1.2.3b5\"\nversion.bump_micro().replace(dev=1234).dumps() # \"1.2.4.dev1234\"\n\n# and post-releases\nversion.bump_postrelease().dumps() # \"1.2.3.post1\"\nVersion(\"1.2.3.post3\").bump_postrelease(2).dumps() # \"1.2.3.post5\"\n\n# easily check if this is a pre- or dev release or a stable version\nVersion(\"1.2.3\").is_stable # True\nVersion(\"1.2.3a6\").is_stable # False\nVersion(\"1.2.3.post3\").is_stable # True\nVersion(\"1.2.3.post3\").get_stable().dumps() # \"1.2.3\"\n```\n\n## Versioning\n\n`newversion` version follows [PEP 440](https://www.python.org/dev/peps/pep-0440/).\n\n## Latest changes\n\nFull changelog can be found in [Releases](https://github.com/vemel/newversion/releases).\n",
"bugtrack_url": null,
"license": "MIT License Copyright (c) 2024 Vlad Emelianov 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": "PEP 440 version manager",
"version": "3.1.0",
"project_urls": {
"Documentation": "https://newversion.readthedocs.io/en/latest/",
"Issues": "https://github.com/vemel/newversion/issues",
"Repository": "https://github.com/vemel/newversion"
},
"split_keywords": [
"version",
" pep440"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "a873ac85309860cca23ec87681507714c02a04df6d6038ffc6fe83b8372b1796",
"md5": "6c71598ac5c6a53643032b3b2f67018d",
"sha256": "c69363bfa68eca5b2559b247000773ccf8896cee97f91942c33a6128c2049e61"
},
"downloads": -1,
"filename": "newversion-3.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6c71598ac5c6a53643032b3b2f67018d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 17944,
"upload_time": "2024-11-10T00:52:38",
"upload_time_iso_8601": "2024-11-10T00:52:38.630611Z",
"url": "https://files.pythonhosted.org/packages/a8/73/ac85309860cca23ec87681507714c02a04df6d6038ffc6fe83b8372b1796/newversion-3.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "949328a56a8c05df3bf722ea47938d1725e731ceb0ab89ae23bfed25bf01a856",
"md5": "9569f8c440052b08cf439e8edce4d0bd",
"sha256": "c7ef57eb0d5a69a92bda13033c923b4f3d1b3782d08a5821ea0aecdf0c07ea3c"
},
"downloads": -1,
"filename": "newversion-3.1.0.tar.gz",
"has_sig": false,
"md5_digest": "9569f8c440052b08cf439e8edce4d0bd",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 20142,
"upload_time": "2024-11-10T00:52:40",
"upload_time_iso_8601": "2024-11-10T00:52:40.407206Z",
"url": "https://files.pythonhosted.org/packages/94/93/28a56a8c05df3bf722ea47938d1725e731ceb0ab89ae23bfed25bf01a856/newversion-3.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-10 00:52:40",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "vemel",
"github_project": "newversion",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "newversion"
}