bumpversion.versioning.functions
Generators for version parts.
PartFunction
class PartFunction()Base class for a version part function.
bump
def bump(value: str) -> strIncrease the value.
validate
def validate(value: str) -> NoneRaise a ValueError if the value can't be explicitly set on this part.
IndependentFunction
class IndependentFunction(value: Union[str, int, None] = None)This is a class that provides an independent function for version parts.
It simply returns the optional value, which is equal to the first value.
bump
def bump(value: Optional[str] = None) -> strReturn the optional value.
CalVerFunction
class CalVerFunction(calver_format: str)This is a class that provides a CalVer function for version parts.
bump
def bump(value: Optional[str] = None) -> strReturn the optional value.
validate
def validate(value: str) -> NoneCalVer values come from the date and can't be set explicitly.
NumericFunction
class NumericFunction(optional_value: Union[str, int, None] = None, first_value: Union[str, int, None] = None)This is a class that provides a numeric function for version parts.
It simply starts with the provided first_value (0 by default) and increases it following the sequence of integer numbers.
The optional value of this function is equal to the first value.
This function also supports alphanumeric parts, altering just the numeric part (e.g. 'r3' --> 'r4'). Only the first numeric group found in the part is considered (e.g. 'r3-001' --> 'r4-001').
bump
def bump(value: Union[str, int]) -> strIncrease the first numerical value by one.
validate
def validate(value: str) -> NoneRaise a ValueError if the value has no digit or is lower than the first value.
ValuesFunction
class ValuesFunction(values: List[str], optional_value: Optional[str] = None, first_value: Optional[str] = None)This is a class that provides a values list based function for version parts.
It is initialized with a list of values and iterates through them when bumping the part.
The default optional value of this function is equal to the first value, but may be otherwise specified.
When trying to bump a part which has already the maximum value in the list you get a ValueError exception.
bump
def bump(value: str) -> strReturn the item after value in the list.
validate
def validate(value: str) -> NoneRaise a ValueError if the value isn't one of the configured values.