Skip to content

version_part

Module for managing Versions and their internal parts.

Classes

VersionConfig

VersionConfig(
    parse: str,
    serialize: Tuple[str],
    search: str,
    replace: str,
    part_configs: Optional[
        Dict[str, VersionComponentSpec]
    ] = None,
)

Hold a complete representation of a version string.

Attributes

order property
order: List[str]

Return the order of the labels in a serialization format.

Currently, order depends on the first given serialization format. This seems like a good idea because this should be the most complete format.

Returns:

List[str]

A list of version part labels in the order they should be rendered.

Functions

parse
parse(
    version_string: Optional[str] = None,
) -> Optional[Version]

Parse a version string into a Version object.

Parameters:

version_string

Version string to parse

TYPE: Optional[str]

DEFAULT: None

Returns:

Optional[Version]

A Version object representing the string.

serialize
serialize(version: Version, context: MutableMapping) -> str

Serialize a version to a string.

Parameters:

version

The version to serialize

TYPE: Version

context

The context to use when serializing the version

TYPE: MutableMapping

Returns:

str

The serialized version as a string

Functions