Skip to content

visualize

Visualize the bumpversion process.

Classes

Border dataclass

Border(corner_bottom_right: str, corner_top_right: str, corner_top_left: str, corner_bottom_left: str, divider_left: str, divider_up: str, divider_down: str, divider_right: str, line: str, pipe: str, cross: str)

A border definition.

Functions:

connection_str

connection_str(border: Border, has_next: bool = False, has_previous: bool = False) -> str

Return the correct connection string based on the next and previous.

PARAMETER DESCRIPTION
border

The border definition to draw the lines

TYPE: Border

has_next

If True, there is a next line

TYPE: bool DEFAULT: False

has_previous

If True, there is a previous line

TYPE: bool DEFAULT: False

RETURNS DESCRIPTION
str

A string that connects left-to-right and top-to-bottom based on the next and previous

filter_version_parts

filter_version_parts(config: Config) -> List[str]

Return the version parts that are in the configuration.

PARAMETER DESCRIPTION
config

The configuration to check against

TYPE: Config

RETURNS DESCRIPTION
List[str]

The version parts that are in the configuration

labeled_line

labeled_line(label: str, border: Border, fit_length: Optional[int] = None) -> str

Return the version part string with the correct padding.

PARAMETER DESCRIPTION
label

The label to render

TYPE: str

border

The border definition to draw the lines

TYPE: Border

fit_length

The length to fit the label to

TYPE: Optional[int] DEFAULT: None

RETURNS DESCRIPTION
str

A labeled line with leading and trailing spaces

lead_string

lead_string(version_str: str, border: Border, blank: bool = False) -> str

Return the first part of a string with the bump character or spaces of the correct amount.

Examples:

>>> lead_string("1.0.0", Border(*BOX_CHARS["light"]))
'1.0.0 ── bump ─'
>>> lead_string("1.0.0", Border(*BOX_CHARS["light"]), blank=True)
'               '
PARAMETER DESCRIPTION
version_str

The string to render as the starting point

TYPE: str

border

The border definition to draw the lines

TYPE: Border

blank

If True, return a blank string the same length as the version bump string

TYPE: bool DEFAULT: False

RETURNS DESCRIPTION
str

The version bump string or a blank string

visualize

visualize(config: Config, version_str: str, box_style: str = 'light') -> None

Output a visualization of the bump-my-version bump process.