pepver


Namepepver JSON
Version 1.1.1 PyPI version JSON
download
home_pagehttps://github.com/technomunk/pepver
SummaryPEP-440 version parsing, interpretation and manipulation
upload_time2023-06-15 12:58:09
maintainer
docs_urlNone
authortechnomunk
requires_python>=3.8,<4.0
licenseMIT
keywords version package
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pepver

[![Python versions](https://img.shields.io/pypi/pyversions/pepver.svg)](https://pypi.org/project/pepver)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Unit tests](https://github.com/technomunk/pepver/actions/workflows/test.yml/badge.svg)](https://github.com/technomunk/pepver/actions/workflows/test.yml)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

PEP-440 version parsing, interpretation and manipulation.

```py
>>> from pepver import Version
>>> version = Version.parse("0!1.2.3.4a5.post6.dev7+8.9")
>>> version.epoch
0
>>> version.release
(1, 2, 3, 4)
>>> version.major
1
>>> version.minor
2
>>> version.micro
3
>>> version.pre
('a', 5)
>>> version.post
6
>>> version.dev
7
>>> version.local
'8.9'
```

## Usage

The main star of the library is the `Version` class, which encompasses the semantics of a version string.
It can be instantiated directly or be parsed from a string:
```py
>>> from pepver import Version
>>> Version(1, 2, 3, 4)
Value(release=(1,), pre=2, post=3, dev=4)
>>> Version((0, 1, 2, 3), post=11, epoch=1)
Value(epoch=1, release=(0, 1, 2, 3), post=11)
>>> Version.parse("11.2")
Value(release=(11, 2))
```

Versions can be updated to suit one's needs:
```py
>>> from pepver import Version
>>> version = Version.parse("0!1.2.3.4a5.post6.dev7+8.9")
>>> version.update("minor")
Value(epoch=0, release=(1, 3))
>>> version.update("post", -2)
Value(epoch=0, release=(1, 2, 3, 4), pre=('a', 5), post=4)
>>> version.update("release")
Value(epoch=0, release=(1, 2, 3, 5))
>>> version.update("release").is_final()
True
```

Versions correctly convert into strings. Note that the conversion is "normalized" ie
standard representation that is the same for the same version:

```py
>>> from pepver import Version
>>> str(Version.parse("010.12-11"))
'10.12.post11'
>>> str(Version.parse("1.2.3preview11dev"))
'1.2.3rc11.dev0'
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/technomunk/pepver",
    "name": "pepver",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8,<4.0",
    "maintainer_email": "",
    "keywords": "version,package",
    "author": "technomunk",
    "author_email": "thegriffones@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/30/3f/35a821f782211a3d53fc5a7212617694aeb23720ee93420551274993da89/pepver-1.1.1.tar.gz",
    "platform": null,
    "description": "# pepver\n\n[![Python versions](https://img.shields.io/pypi/pyversions/pepver.svg)](https://pypi.org/project/pepver)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Unit tests](https://github.com/technomunk/pepver/actions/workflows/test.yml/badge.svg)](https://github.com/technomunk/pepver/actions/workflows/test.yml)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n\nPEP-440 version parsing, interpretation and manipulation.\n\n```py\n>>> from pepver import Version\n>>> version = Version.parse(\"0!1.2.3.4a5.post6.dev7+8.9\")\n>>> version.epoch\n0\n>>> version.release\n(1, 2, 3, 4)\n>>> version.major\n1\n>>> version.minor\n2\n>>> version.micro\n3\n>>> version.pre\n('a', 5)\n>>> version.post\n6\n>>> version.dev\n7\n>>> version.local\n'8.9'\n```\n\n## Usage\n\nThe main star of the library is the `Version` class, which encompasses the semantics of a version string.\nIt can be instantiated directly or be parsed from a string:\n```py\n>>> from pepver import Version\n>>> Version(1, 2, 3, 4)\nValue(release=(1,), pre=2, post=3, dev=4)\n>>> Version((0, 1, 2, 3), post=11, epoch=1)\nValue(epoch=1, release=(0, 1, 2, 3), post=11)\n>>> Version.parse(\"11.2\")\nValue(release=(11, 2))\n```\n\nVersions can be updated to suit one's needs:\n```py\n>>> from pepver import Version\n>>> version = Version.parse(\"0!1.2.3.4a5.post6.dev7+8.9\")\n>>> version.update(\"minor\")\nValue(epoch=0, release=(1, 3))\n>>> version.update(\"post\", -2)\nValue(epoch=0, release=(1, 2, 3, 4), pre=('a', 5), post=4)\n>>> version.update(\"release\")\nValue(epoch=0, release=(1, 2, 3, 5))\n>>> version.update(\"release\").is_final()\nTrue\n```\n\nVersions correctly convert into strings. Note that the conversion is \"normalized\" ie\nstandard representation that is the same for the same version:\n\n```py\n>>> from pepver import Version\n>>> str(Version.parse(\"010.12-11\"))\n'10.12.post11'\n>>> str(Version.parse(\"1.2.3preview11dev\"))\n'1.2.3rc11.dev0'\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "PEP-440 version parsing, interpretation and manipulation",
    "version": "1.1.1",
    "project_urls": {
        "Homepage": "https://github.com/technomunk/pepver",
        "Repository": "https://github.com/technomunk/pepver"
    },
    "split_keywords": [
        "version",
        "package"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "460b96b21582bb389766efe83c1e490d9388a35dd154caad409106379cac60db",
                "md5": "b59bb6d8c5d5417972348d019aa1707f",
                "sha256": "2bc44e73a8f508997c6d4ed2193092785c21358f0eacba1cdcfcd41a0d609b90"
            },
            "downloads": -1,
            "filename": "pepver-1.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b59bb6d8c5d5417972348d019aa1707f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8,<4.0",
            "size": 6555,
            "upload_time": "2023-06-15T12:58:08",
            "upload_time_iso_8601": "2023-06-15T12:58:08.678435Z",
            "url": "https://files.pythonhosted.org/packages/46/0b/96b21582bb389766efe83c1e490d9388a35dd154caad409106379cac60db/pepver-1.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "303f35a821f782211a3d53fc5a7212617694aeb23720ee93420551274993da89",
                "md5": "3bc868eb862260e819585d981a1d18e3",
                "sha256": "9bb7a90d404bae88f8f6bd9a14fb83e148d77fbcbd222c8b577cab522ef6d8fa"
            },
            "downloads": -1,
            "filename": "pepver-1.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "3bc868eb862260e819585d981a1d18e3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8,<4.0",
            "size": 6042,
            "upload_time": "2023-06-15T12:58:09",
            "upload_time_iso_8601": "2023-06-15T12:58:09.719032Z",
            "url": "https://files.pythonhosted.org/packages/30/3f/35a821f782211a3d53fc5a7212617694aeb23720ee93420551274993da89/pepver-1.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-15 12:58:09",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "technomunk",
    "github_project": "pepver",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pepver"
}
        
Elapsed time: 0.07525s