newversion


Namenewversion JSON
Version 1.8.0 PyPI version JSON
download
home_pagehttps://github.com/vemel/newversion
SummaryYour version manager
upload_time2021-03-16 20:16:50
maintainer
docs_urlNone
authorVlad Emelianov
requires_python
licenseMIT
keywords pep440 versioning version ci automation
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # NewVersion - Your version manager

[![PyPI - newversion](https://img.shields.io/pypi/v/newversion.svg?color=blue&label=newversion)](https://pypi.org/project/newversion)
[![Docs](https://img.shields.io/readthedocs/newversion.svg?color=blue&label=Builder%20docs)](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 - Your version manager](#newversion---your-version-manager)
  - [Features](#features)
  - [Installation](#installation)
  - [Usage](#usage)
    - [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

### CLI

```bash
newversion            # 0.0.0
newversion bump major # 1.0.0

# get package version from pyproject.toml, setup.cfg or setup.py
newversion package # 1.2.3
newversion package | newversion bump  # 1.2.4
newversion package | newversion get minor  # 2


# bump minor version and update package version
newversion package | newversion bump minor | newversion set_package

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).

# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to
[PEP 440 -- Version Identification and Dependency Specification](https://www.python.org/dev/peps/pep-0440/).

## [Unreleased]

## [1.8.0] - 2021-03-16
### Added
- `[cli]` `package` command to get Python package version
- `[cli]` `set_package` command to set Python package version

## [1.7.0] - 2021-03-15

## [1.7.0rc1] - 2021-03-15
### Added
- `[cli]` `echo "1.2.3" | newversion ne "1.2.4"` comamnd to raise error if version is not equal to other

### Changed
- `[api]` reworked `Executor` for easier usage as API

### Fixed
- `[packaging]` console entrypoint `newversion` was not present in wheel package
- `[version]` error on getting `epoch`
- `[packaging]` `typing_extensions` are no longer needed on `python > 3.8`

## [0.1.5] - 2021-02-25
### Changed
- Added compatibility with Python 3.6.10+



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/vemel/newversion",
    "name": "newversion",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "pep440,versioning,version,ci,automation",
    "author": "Vlad Emelianov",
    "author_email": "vlad.emelianov.nz@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/c4/51/7a82e051e2ecd71035bd47f9f35adef63ce6818c9ad9d317bfb863178ae6/newversion-1.8.0.tar.gz",
    "platform": "",
    "description": "# NewVersion - Your version manager\n\n[![PyPI - newversion](https://img.shields.io/pypi/v/newversion.svg?color=blue&label=newversion)](https://pypi.org/project/newversion)\n[![Docs](https://img.shields.io/readthedocs/newversion.svg?color=blue&label=Builder%20docs)](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 - Your version manager](#newversion---your-version-manager)\n  - [Features](#features)\n  - [Installation](#installation)\n  - [Usage](#usage)\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### 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 package # 1.2.3\nnewversion package | newversion bump  # 1.2.4\nnewversion package | newversion get minor  # 2\n\n\n# bump minor version and update package version\nnewversion package | newversion bump minor | newversion set_package\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\n# Changelog\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),\nand this project adheres to\n[PEP 440 -- Version Identification and Dependency Specification](https://www.python.org/dev/peps/pep-0440/).\n\n## [Unreleased]\n\n## [1.8.0] - 2021-03-16\n### Added\n- `[cli]` `package` command to get Python package version\n- `[cli]` `set_package` command to set Python package version\n\n## [1.7.0] - 2021-03-15\n\n## [1.7.0rc1] - 2021-03-15\n### Added\n- `[cli]` `echo \"1.2.3\" | newversion ne \"1.2.4\"` comamnd to raise error if version is not equal to other\n\n### Changed\n- `[api]` reworked `Executor` for easier usage as API\n\n### Fixed\n- `[packaging]` console entrypoint `newversion` was not present in wheel package\n- `[version]` error on getting `epoch`\n- `[packaging]` `typing_extensions` are no longer needed on `python > 3.8`\n\n## [0.1.5] - 2021-02-25\n### Changed\n- Added compatibility with Python 3.6.10+\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Your version manager",
    "version": "1.8.0",
    "split_keywords": [
        "pep440",
        "versioning",
        "version",
        "ci",
        "automation"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "5bb32ba02be71fcaa6efaa4df47d8800",
                "sha256": "9578f0594f9236dc95a582267d9126fb23c5b545d124ee5ac3b91c4e88cdb6b1"
            },
            "downloads": -1,
            "filename": "newversion-1.8.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5bb32ba02be71fcaa6efaa4df47d8800",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 16417,
            "upload_time": "2021-03-16T20:16:48",
            "upload_time_iso_8601": "2021-03-16T20:16:48.641391Z",
            "url": "https://files.pythonhosted.org/packages/b4/50/919122b5d90cd0111f8095c98e88891b2b4aab9e757b89646dbcb14c4d00/newversion-1.8.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "49fdfdd0a6d6b45ed9ec906e5bffad3b",
                "sha256": "2c24ee0a70eb083866c55786b6a4db5f44f5e8585b68fad0cf5c7bf22ff9f56e"
            },
            "downloads": -1,
            "filename": "newversion-1.8.0.tar.gz",
            "has_sig": false,
            "md5_digest": "49fdfdd0a6d6b45ed9ec906e5bffad3b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 15716,
            "upload_time": "2021-03-16T20:16:50",
            "upload_time_iso_8601": "2021-03-16T20:16:50.005526Z",
            "url": "https://files.pythonhosted.org/packages/c4/51/7a82e051e2ecd71035bd47f9f35adef63ce6818c9ad9d317bfb863178ae6/newversion-1.8.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2021-03-16 20:16:50",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": null,
    "github_project": "vemel",
    "error": "Could not fetch GitHub repository",
    "lcname": "newversion"
}
        
Elapsed time: 0.24443s