Skip to content

bumpversion.context ​

Context for rendering messages and tags.

MONTH_ABBREVIATIONS ​

python
MONTH_ABBREVIATIONS = [abbr for abbr in calendar.month_abbr if abbr]

CALVER_PATTERN_MAP ​

python
CALVER_PATTERN_MAP = {'{YYYY}': '(?:[1-9][0-9]{3})', '{YY}': '(?:[1-9][0-9]?|0|[1-9][0-9]{2})', '{0Y}': '(?:[0-9]{2}|[0-9]{3})', '{MMM}': f"(?:{'|'.join(MONTH_ABBREVIATIONS)})", '{MM}': '(?:1[0-2]|[1-9])', '{0M}': '(?:1[0-2]|0[1-9])', '{DD}': '(?:3[0-1]|[1-2][0-9]|[1-9])', '{0D}': '(?:3[0-1]|[1-2][0-9]|0[1-9])', '{JJJ}': '(?:36[0-6]|3[0-5][0-9]|[1-2][0-9][0-9]|[1-9][0-9]|[1-9])', '{00J}': '(?:36[0-6]|3[0-5][0-9]|[1-2][0-9][0-9]|0[1-9][0-9]|00[1-9])', '{Q}': '(?:[1-4])', '{WW}': '(?:5[0-3]|[1-4][0-9]|[0-9])', '{0W}': '(?:5[0-3]|[0-4][0-9])', '{UU}': '(?:5[0-3]|[1-4][0-9]|[0-9])', '{0U}': '(?:5[0-3]|[0-4][0-9])', '{VV}': '(?:5[0-3]|[1-4][0-9]|[1-9])', '{0V}': '(?:5[0-3]|[1-4][0-9]|0[1-9])', '{GGGG}': '(?:[1-9][0-9]{3})', '{GG}': '(?:[0-9][0-9]?)', '{0G}': '(?:[0-9]{2})', '{INC0}': '(?:[0-9]+)', '{INC1}': '[1-9][0-9]*'}

calver_string_to_regex ​

python
def calver_string_to_regex(calver_format: str) -> str

Convert the calver format string to a regex pattern.

prefixed_environ ​

python
def prefixed_environ() -> dict

Return a dict of the environment with keys wrapped in ${}.

base_context ​

python
def base_context(config: Config) -> ChainMap

The default context for rendering messages and tags.

get_context ​

python
def get_context(config: Config, current_version: Optional[Version] = None, new_version: Optional[Version] = None) -> ChainMap

Return the context for rendering messages and tags.

get_datetime_info ​

python
def get_datetime_info(current_dt: datetime.datetime) -> dict

Return the full structure of the given datetime for formatting.