models
Models for managing versioning of software projects.
Classes¶
Version
¶
Version(
version_spec: VersionSpec,
components: Dict[str, VersionComponent],
original: Optional[str] = None,
)
The specification of a version and its parts.
VersionComponent
¶
VersionComponent(
values: Optional[list] = None,
optional_value: Optional[str] = None,
first_value: Union[str, int, None] = None,
independent: bool = False,
always_increment: bool = False,
calver_format: Optional[str] = None,
source: Optional[str] = None,
value: Union[str, int, None] = None,
)
VersionComponentSpec
¶
Bases: BaseModel
Configuration of a version component.
This is used to read in the configuration from the bumpversion config file.
Attributes¶
always_increment
class-attribute
instance-attribute
¶
always_increment: bool = False
Should the component always increment, even if it is not necessary?
calver_format
class-attribute
instance-attribute
¶
calver_format: Optional[str] = None
The format string for a CalVer component.
depends_on
class-attribute
instance-attribute
¶
depends_on: Optional[str] = None
The name of the component this component depends on.
first_value
class-attribute
instance-attribute
¶
first_value: Union[str, int, None] = None
The first value to increment from.
independent
class-attribute
instance-attribute
¶
independent: bool = False
Is the component independent of the other components?
optional_value
class-attribute
instance-attribute
¶
optional_value: Optional[str] = None
The value that is optional to include in the version.
- Defaults to first value in values or 0 in the case of numeric.
- Empty string means nothing is optional.
- CalVer components ignore this.
values
class-attribute
instance-attribute
¶
values: Optional[list] = None
The possible values for the component. If it and calver_format
is None, the component is numeric.
Functions¶
create_component
¶
create_component(
value: Union[str, int, None] = None
) -> VersionComponent
Generate a version component from the configuration.
set_always_increment_with_calver
classmethod
¶
set_always_increment_with_calver(data: Any) -> Any
Set always_increment to True if calver_format is present.
VersionSpec
¶
VersionSpec(
components: Dict[str, VersionComponentSpec],
order: Optional[List[str]] = None,
)
The specification of a version’s components and their relationships.