pep440-version-utils


Namepep440-version-utils JSON
Version 1.0.0 PyPI version JSON
download
home_pagehttps://github.com/m-vdb/pep440-version-utils
SummaryUtilities to deal with pep440 versioning
upload_time2023-11-29 08:23:01
maintainerMaxime Verger
docs_urlNone
authorMaxime Verger
requires_python>=3.8,<3.11
licenseMIT
keywords pep440 version
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ![Continuous Integration](https://github.com/m-vdb/pep440-version-utils/workflows/Continuous%20Integration/badge.svg)
[![Coverage Status](https://coveralls.io/repos/github/m-vdb/pep440-version-utils/badge.svg?branch=main)](https://coveralls.io/github/m-vdb/pep440-version-utils?branch=main)

# pep440-version-utils
This package regroups utilities to deal with pep440 versioning. It is based on the
[PyPA's `packaging`](https://github.com/pypa/packaging) project and extends it.

It makes it easier to handle version bumps and strictly follows [PEP440 specification](https://www.python.org/dev/peps/pep-0440/).

![Release cycle](https://github.com/m-vdb/pep440-version-utils/blob/main/docs/release-cycle.png?raw=true)

## Installation

Use `pip` or `poetry` to install this package:

```bash
$ pip install pep440-version-utils

# or alternatively
$ poetry add pep440-version-utils
```

## Usage

Since this package extends the `packaging` library, so it supports version parsing and ordering as described
in [this documentation](https://packaging.pypa.io/en/latest/version/).

To bump to a new release version:

```python
from pep440_version_utils import Version

version = Version("1.10.2")
version.next_micro()  # 1.10.3
version.next_minor()  # 1.11.0
version.next_major()  # 2.0.0
```

To bump to a new prerelease version:

```python
from pep440_version_utils import Version

version = Version("1.10.2")
version.next_alpha()  # 1.10.3a1
version.next_beta()  # 1.10.3b1
version.next_release_candidate()  # 1.10.3rc1

version.next_alpha("minor")  # 1.11.0a1
version.next_beta("mior")  # 1.11.0b1
version.next_release_candidate("major")  # 2.0.0rc1
```

And it implements the full release cycle:

```python
from pep440_version_utils import Version

version = Version("1.10.2")
alpha1 = version.next_alpha()  # 1.10.3a1
alpha2 = alpha1.next_alpha()  # 1.10.3a2
beta1 = alpha2.next_beta()  # 1.10.3b1
rc1 = beta1.next_release_candidate()  # 1.10.3rc1
rc2 = rc1.next_release_candidate()  # 1.10.3rc2
new_version = rc2.next_micro()  # 1.10.3
```

You can also check if a version is a specific type of prerelease:
```python
from pep440_version_utils import Version

Version("1.10.2a1").is_alpha  # True
Version("1.10.2b2").is_beta  # True
Version("1.10.2rc1").is_release_candidate  # True
```

## Limitations

This package doesn't support _post_, _dev_ and _local_ versions yet. **Contributions are welcome 😊**

## How to contribute

This package is fairly simple, here is how you can contribute:

1. ⚙️ Install [`poetry`](https://python-poetry.org/)
2. 📦 In the repository folder, run `poetry install`
3. ✍️ Implement the desired changes
4. ✅ Run test, type checking and code quality checks:
```bash
$ poetry run black . --check
$ poetry run mypy */**.py --ignore-missing-imports
$ poetry run pytest --cov=pep440_version_utils
```
5. ➡️ Submit a new pull request

Do not hesitate to contribue, even for very small changes!

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/m-vdb/pep440-version-utils",
    "name": "pep440-version-utils",
    "maintainer": "Maxime Verger",
    "docs_url": null,
    "requires_python": ">=3.8,<3.11",
    "maintainer_email": "me@maxvdb.com",
    "keywords": "pep440,version",
    "author": "Maxime Verger",
    "author_email": "me@maxvdb.com",
    "download_url": "https://files.pythonhosted.org/packages/a8/45/f35006f4fd4eac47dba06c2069b81f90fb4e1caaa45f581d48ebcc0ed53e/pep440_version_utils-1.0.0.tar.gz",
    "platform": null,
    "description": "![Continuous Integration](https://github.com/m-vdb/pep440-version-utils/workflows/Continuous%20Integration/badge.svg)\n[![Coverage Status](https://coveralls.io/repos/github/m-vdb/pep440-version-utils/badge.svg?branch=main)](https://coveralls.io/github/m-vdb/pep440-version-utils?branch=main)\n\n# pep440-version-utils\nThis package regroups utilities to deal with pep440 versioning. It is based on the\n[PyPA's `packaging`](https://github.com/pypa/packaging) project and extends it.\n\nIt makes it easier to handle version bumps and strictly follows [PEP440 specification](https://www.python.org/dev/peps/pep-0440/).\n\n![Release cycle](https://github.com/m-vdb/pep440-version-utils/blob/main/docs/release-cycle.png?raw=true)\n\n## Installation\n\nUse `pip` or `poetry` to install this package:\n\n```bash\n$ pip install pep440-version-utils\n\n# or alternatively\n$ poetry add pep440-version-utils\n```\n\n## Usage\n\nSince this package extends the `packaging` library, so it supports version parsing and ordering as described\nin [this documentation](https://packaging.pypa.io/en/latest/version/).\n\nTo bump to a new release version:\n\n```python\nfrom pep440_version_utils import Version\n\nversion = Version(\"1.10.2\")\nversion.next_micro()  # 1.10.3\nversion.next_minor()  # 1.11.0\nversion.next_major()  # 2.0.0\n```\n\nTo bump to a new prerelease version:\n\n```python\nfrom pep440_version_utils import Version\n\nversion = Version(\"1.10.2\")\nversion.next_alpha()  # 1.10.3a1\nversion.next_beta()  # 1.10.3b1\nversion.next_release_candidate()  # 1.10.3rc1\n\nversion.next_alpha(\"minor\")  # 1.11.0a1\nversion.next_beta(\"mior\")  # 1.11.0b1\nversion.next_release_candidate(\"major\")  # 2.0.0rc1\n```\n\nAnd it implements the full release cycle:\n\n```python\nfrom pep440_version_utils import Version\n\nversion = Version(\"1.10.2\")\nalpha1 = version.next_alpha()  # 1.10.3a1\nalpha2 = alpha1.next_alpha()  # 1.10.3a2\nbeta1 = alpha2.next_beta()  # 1.10.3b1\nrc1 = beta1.next_release_candidate()  # 1.10.3rc1\nrc2 = rc1.next_release_candidate()  # 1.10.3rc2\nnew_version = rc2.next_micro()  # 1.10.3\n```\n\nYou can also check if a version is a specific type of prerelease:\n```python\nfrom pep440_version_utils import Version\n\nVersion(\"1.10.2a1\").is_alpha  # True\nVersion(\"1.10.2b2\").is_beta  # True\nVersion(\"1.10.2rc1\").is_release_candidate  # True\n```\n\n## Limitations\n\nThis package doesn't support _post_, _dev_ and _local_ versions yet. **Contributions are welcome \ud83d\ude0a**\n\n## How to contribute\n\nThis package is fairly simple, here is how you can contribute:\n\n1. \u2699\ufe0f Install [`poetry`](https://python-poetry.org/)\n2. \ud83d\udce6 In the repository folder, run `poetry install`\n3. \u270d\ufe0f Implement the desired changes\n4. \u2705 Run test, type checking and code quality checks:\n```bash\n$ poetry run black . --check\n$ poetry run mypy */**.py --ignore-missing-imports\n$ poetry run pytest --cov=pep440_version_utils\n```\n5. \u27a1\ufe0f Submit a new pull request\n\nDo not hesitate to contribue, even for very small changes!\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Utilities to deal with pep440 versioning",
    "version": "1.0.0",
    "project_urls": {
        "Homepage": "https://github.com/m-vdb/pep440-version-utils",
        "Repository": "https://github.com/m-vdb/pep440-version-utils"
    },
    "split_keywords": [
        "pep440",
        "version"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f5dee070193a49942cd5c15fd9c880b31968496875447b0f1e34ac43873eb849",
                "md5": "ed86b9b75e052a77179a9e3ed4b025a6",
                "sha256": "5140d35f9451eb02b28e76f0d5cd0f0d6d9d4154c3dec69653a5c8a08fb7ef97"
            },
            "downloads": -1,
            "filename": "pep440_version_utils-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ed86b9b75e052a77179a9e3ed4b025a6",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8,<3.11",
            "size": 5148,
            "upload_time": "2023-11-29T08:22:59",
            "upload_time_iso_8601": "2023-11-29T08:22:59.707057Z",
            "url": "https://files.pythonhosted.org/packages/f5/de/e070193a49942cd5c15fd9c880b31968496875447b0f1e34ac43873eb849/pep440_version_utils-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a845f35006f4fd4eac47dba06c2069b81f90fb4e1caaa45f581d48ebcc0ed53e",
                "md5": "e0e0c0cdb756431357eeabfb4220f96c",
                "sha256": "7ce03456ce4429e7d29547ccffd15c19dbb851c9e1960c2fa5b281959da1083a"
            },
            "downloads": -1,
            "filename": "pep440_version_utils-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "e0e0c0cdb756431357eeabfb4220f96c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8,<3.11",
            "size": 4267,
            "upload_time": "2023-11-29T08:23:01",
            "upload_time_iso_8601": "2023-11-29T08:23:01.533941Z",
            "url": "https://files.pythonhosted.org/packages/a8/45/f35006f4fd4eac47dba06c2069b81f90fb4e1caaa45f581d48ebcc0ed53e/pep440_version_utils-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-29 08:23:01",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "m-vdb",
    "github_project": "pep440-version-utils",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pep440-version-utils"
}
        
Elapsed time: 0.16494s