v440 - Mutable version object handling based on PEP 440

Source Code: https://github.com/johannes-programming/v440
The project v440 provides a mutable version object that allows flexible manipulation of version strings following the PEP 440 standard. It includes features such as support for release versions, pre-releases (alpha, beta, release candidate), post-releases, development releases, and local versions. The Version class enables direct manipulation of version components, such as major, minor, micro parts, and local identifiers. This project also supports version comparison and formatting, error handling for invalid version strings, and advanced versioning scenarios, like handling epochs, pre-releases, and complex version string combinations. Extensive unit tests ensure the accuracy of these operations.

Core Components

The v440 module is built around the class v440.Version. Its instances are mutable representations of PEP 440 conforming versions allowing to manipulate the specific parts of the version identifiers individually.

from v440 import Version

# Create an instance of the v440.Version class
v = Version("1.2.3")

# The instance allows manipulation of individual parts of the version
v.release.major = 2
v.release.minor = 5
v.pre = "beta.1"
v.local = "local.7.dev"

# Print the modified version
print(v)  # Output: 2.5.3b1+local.7.dev

Quick Links for the properties of v440.Version

Name Description Getter Setter
base Represents epoch and release. Gives a copy trunkated to only epoch and release. Overwrites epoch and release.
data Represents the entire instance. Gives string representation. Overwrites all properties.
dev Represents the devrelease part of the version identifier. Gives None or a non negative integer. Converts and saves the value.
epoch Represents the epoch part of the version identifier. Gives a non negative integer. Converts and saves the value.
local Represents the local part of the version identifier. Gives a modified list-like object that can be altered. Converts the value and saves it inside of local.
post Represents the postrelease part of the version identifier. Gives None or a non negative integer. Converts and saves the value.
pre Represents the prerelease part of the version identifier. Gives a specialized list-like object that can be altered. Converts the value and saves it inside of pre.
public Represents the public part of the version identifier (everything but local. Gives a copy without local. Overwrites all properties except for public.
release Represents the release part of the version identifier. Gives a specialized list-like object that can be altered. Converts the value and saves it inside of release.

Version Object Examples


v = Version("1.0.0")
print(str(v))  # Output: 1.0.0
v.release[1] = 5
print(str(v))  # Output: 1.5.0