v440

Major Series Two

Overview

The project v440 is a PyPI project that provides mutable version objects that allow flexible manipulation of version identifiers following the PEP440 standard.

Installation
Features
v440.abc
class v440.abc.CoreABC.CoreABC(string: Any)

This abstract base class is the ancestor of all core classes. It enforces some standards in its decendents.

All properties have always a getter, never a deleter, and sometimes a setter. The property without setter are explained under NestedABC. The properties with setter are of an immutable builtin type. The setter allows allows for replacing the value with another. If the setter receives an invalid value then a VersionError is raised and the instance is left unchanged.

__bool__() -> bool

This magic method implements bool(self).

It is defined as equivalent to self == type(self)().

__eq__(other: Any) -> bool

This magic method implements self == other.

It is defined as equivalent to type(self) is type(other) and self.string == other.string.

__format__(format_spec: Any) -> str

The instances of each class can be formatted. A format spec is always either valid or invalid for a certain class. The empty string is valid for all classes and provides the standardized string. The format function always returns a PEP440-conforming string notation of the formatted object. Each possible PEP440-conforming notation of an object has at least one valid format spec that allows for its recreation in formatting.

__ge__(other: Any) -> bool

This magic method implements self >= other.

See also __le__.

__gt__(other: Any) -> bool

This magic method implements self > other.

See also __le__.

__hash__() -> int

See unhash.

__le__(other: Any) -> bool

This magic method implements self <= other.

Each class implements a total order of all of its possible instances - with the sole exception of Pre("") which is neither greater than nor lesser than any instances of Pre. Each class is ordered in accordance with PEP440.

__lt__(other: Any) -> bool

This magic method implements self < other.

See also __le__.

__ne__(other: Any) -> bool
__repr__() -> str
__subclasshook__(cls: type, other: type, /) -> bool

This magic classmethod always returns NotImplemented.

__str__() -> str
copy() -> Self
deformat(*strings: str) -> str

This classmethod takes PEP440-conforming strings and returns the shorted possible format spec that can recreate all of them in formatting. The classmethod raises a VersionError iff an argument is not actually PEP440-conforming or no common format spec exists.

packaging: Any

This property connects v440 with the packaging project. Its getter converts self to an appropriate value for the packaging project. Its setter takes such a value and configures self to match.

string: str

This property represents self as a string. self.string returns the same value as str(self). Setting this property allows to change the object in question to the state represented by the provided value. The string property accepts any value iff that value provides a PEP440-conforming string. It (and therefore also calling str) always returns a standardized PEP440-conforming string. Two objects of the same type are equal iff their string properties are equal.

class v440.abc.ListABC.ListABC

This abstract base class inherits from CoreABC and from datahold.OkayList.

__add__(other: Any) -> Self
__bool__() -> bool
__contains__(other: Any) -> bool
__delitem__(key: Any) -> None
__eq__(other: Any) -> bool
__format__(format_spec: Any) -> str
__ge__(other: Any) -> bool
__getitem__(key: Any) -> Any
__gt__(other: Any) -> bool
__hash__() -> int
__iadd__(value: Any) -> Any
__imul__(value: Any) -> Any
__iter__() -> Any
__le__(other: Any) -> bool
__len__() -> int
__lt__(other: Any) -> bool

This magic method implements self < other.

See also __le__.

__mul__() -> Any
__ne__(other: Any) -> bool
__radd__() -> str
__rand__() -> str
__repr__() -> str
__subclasshook__(cls: type, other: type, /) -> bool

This magic classmethod always returns NotImplemented.

__str__() -> str
copy() -> Self
deformat(*strings: str) -> str

This classmethod takes PEP440-conforming strings and returns the shorted possible format spec that can recreate all of them in formatting. The classmethod raises a VersionError iff an argument is not actually PEP440-conforming or no common format spec exists.

packaging: Any

This property connects v440 with the packaging project. Its getter converts self to an appropriate value for the packaging project. Its setter takes such a value and configures self to match.

string: str

This property represents self as a string. self.string returns the same value as str(self). Setting this property allows to change the object in question to the state represented by the provided value. The string property accepts any value iff that value provides a PEP440-conforming string. It (and therefore also calling str) always returns a standardized PEP440-conforming string. Two objects of the same type are equal iff their string properties are equal.

class v440.abc.NestedABC.NestedABC

This abstract base class inherits from CoreABC.

deformat(*strings: str) -> str
packaging: Any
string: str
class v440.abc.QualABC.QualABC

This abstract base class inherits from CoreABC.

deformat(*strings: str) -> str
lit: str
num: int
packaging: Any
string: str
v440.core

This subpackage contains the principle classes of the project. Each of these classes has a dedicated module inside of core.

class v440.core.Base.Base(string: Any = "0")

This class represents the base part of a public version identifier.

epoch: int

This property represents the epoch.

packaging: str

This property represents the equivalent packaging.version.Version.base_version value.

It is defined as an alias of Base.string.

release: Release

This property represents the release.

string: str
class v440.core.Dev.Dev(string: Any = "")

This class represents the developmental release information.

lit: str

This property represents the literal part of the information. It can take the values "" (with the numeral 0) and "dev" (with any non-negative numeral).

num: int

This property represents the numeral part of the information. It can only take non-negative values and is restricted to 0 if lit is "".

packaging: Optional[int]

This property represents the equivalent packaging.version.Version.dev value.

string: str
class v440.core.Local.Local(string: Any = "")

This list-like class represents the local part of version identifiers. Its items are integers and strings. Asside from the members listed below it also implements indeces and methods exactly as list does.

data: tuple[int | str, ...]

This property represents the respective Local instance as a tuple.

packaging: Optional[str]

This property represents the equivalent packaging.version.Version.local value.

string: str
class v440.core.Post.Post(string: Any = "")

This class represents the post-release information.

lit: str

This property represents the literal part of the information. It can take the values "" (with the numeral 0) and "post" (with any non-negative numeral).

num: int

This property represents the numeral part of the information. It can only take non-negative values and is restricted to 0 if lit is "".

packaging: Optional[int]

This property represents the equivalent packaging.version.Version.post value.

string: str

This property represents the Post object as a string.

class v440.core.Pre.Pre(string: Any = "")

This class represents the pre-release information.

lit: str

This property represents the literal part of the information. It can take the values "", "a", "b", and "rc". The value "" demands the numeral 0. It signifies that we are not dealing with a pre-release. All other values tolerate any non-negative numeral. Each of them represents another phase of the pre-release process: alpha-releases, beta-releases, and previews.

num: int

This property represents the numeral part of the information. It can only take non-negative values and is restricted to 0 if lit is "".

packaging: Optional[tuple[str, int]]

This property represents the equivalent packaging.version.Version.pre value.

string: str

This property represents the Pre object as a string.

class v440.core.Public.Public(string: Any = "0")
base: Base
packaging: str

This property represents the equivalent packaging.version.Version.public value.

It is defined as an alias of Public.string.

qual: Qual
string: str

This property represents the Public object as a string.

class v440.core.Qual.Qual(string: Any = "")
dev: Dev
isdevrelease() -> bool

This method returns whether the current instance denotes a dev-release.

isprerelease() -> bool

This method returns whether the current instance denotes a pre-release.

ispostrelease() -> bool

This method returns whether the current instance denotes a post-release.

packaging: str

Strictly speaking, the Qual class does not have a counterpart in packaging. From inference this property is defined as an alias of Qual.string.

post: Post
pre: Pre
string: str

This property represents the Qual object as a string.

class v440.core.Release.Release(string: Any = "0")
data: tuple

This property represents the data of the Release object.

major: int
micro: int
minor: int
packaging: tuple

This property represents the equivalent packaging.version.Version.release value.

patch: int
string: str

This property represents the Release object as a string.

class v440.core.Version.Version(string: Any = "0")

This class is the centrepiece of the v440 project.

local: Local

This property represents the local part of the version identifier.

packaging: packaging.version.Version

This property represents the equivalent packaging.version.Version.

public: Public

This property represents the public part of the version identifier.

string: str

This property represents the Version object as a string.

v440.errors
class v440.errors.VersionError.VersionError(*args: Any)
args: tuple
v440.tests

This subpackage allows for testing with unittest.

v440.tests.test() -> unittest.TextTestResult
License
Earlier Versions

The documentation of the prior implementation of this project can be found here.

Impressum