Skip to content

bumpversion.versioning.version_config ​

Module for managing Versions and their internal parts.

logger ​

python
logger = get_indented_logger(__name__)

VersionConfig ​

python
class 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.

order ​

python
order: List[str]

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

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

parse ​

python
def parse(version_string: Optional[str] = None, raise_error: bool = False) -> Optional[Version]

Parse a version string into a Version object.

Parameters

  • version_string: Version string to parse
  • raise_error: Raise an exception if a version string is invalid

Returns

  • A Version object representing the string.

Raises

  • BumpVersionError: If a version string is invalid and raise_error is True.

serialize ​

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

Serialize a version to a string.

Parameters

  • version: The version to serialize
  • context: The context to use when serializing the version

Returns

  • The serialized version as a string