Skip to main content

pepver

Python versions License: MIT Unit tests Code style: black

PEP-440 version parsing, interpretation and manipulation.

>>> 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:

>>> 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:

>>> 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:

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

Release files for pepver 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pepver 1.1.1
File Size Uploaded
pepver-1.1.1.tar.gz 6.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pepver 1.1.1
File Interpreter ABI Platform
pepver-1.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 12.6 kB

Release files / pepver-1.1.1.tar.gz

Download URL pepver-1.1.1.tar.gz
Size 6.0 kB
Tags Source
SHA-256 checksum
How to use checksums
9bb7a90d404bae88f8f6bd9a14fb83e148d77fbcbd222c8b577cab522ef6d8fa
BLAKE2b-256 checksum
How to use checksums
303f35a821f782211a3d53fc5a7212617694aeb23720ee93420551274993da89
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.10.6 Linux/5.15.0-1039-azure

Release files / pepver-1.1.1-py3-none-any.whl

Download URL pepver-1.1.1-py3-none-any.whl
Size 6.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2bc44e73a8f508997c6d4ed2193092785c21358f0eacba1cdcfcd41a0d609b90
BLAKE2b-256 checksum
How to use checksums
460b96b21582bb389766efe83c1e490d9388a35dd154caad409106379cac60db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.10.6 Linux/5.15.0-1039-azure
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page