bumpversion.config
Configuration management.
logger
python
logger = get_indented_logger(__name__)DEFAULTS
python
DEFAULTS = {'current_version': None, 'parse': '(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)', 'serialize': ('{major}.{minor}.{patch}',), 'search': '{current_version}', 'replace': '{new_version}', 'regex': False, 'ignore_missing_version': False, 'ignore_missing_files': False, 'tag': False, 'push_tag': False, 'sign_tags': False, 'tag_name': 'v{new_version}', 'tag_message': 'Bump version: {current_version} → {new_version}', 'allow_dirty': False, 'allow_dirty_files': [], 'commit': False, 'message': 'Bump version: {current_version} → {new_version}', 'moveable_tags': [], 'commit_args': None, 'pep621_info': None, 'scm_info': None, 'parts': {}, 'files': [], 'setup_hooks': [], 'pre_commit_hooks': [], 'post_commit_hooks': [], 'allow_shell_hooks': False}set_config_defaults
python
def set_config_defaults(parsed_config: dict[str, Any], overrides: Any = {}) -> dict[str, Any]Apply the defaults to the parsed config.
get_configuration
python
def get_configuration(config_file: Optional[Pathlike] = None, overrides: Any = {}) -> ConfigReturn the configuration based on any configuration files and overrides.
Parameters
config_file: An explicit configuration file to use, otherwise search for one**overrides: Specific configuration key-values to override in the configuration
Returns
- The configuration
check_current_version
python
def check_current_version(config: Config) -> strReturns the current version.
If the current version is not specified in the config file, command line or env variable, it attempts to retrieve it via a tag.
Parameters
config: The current configuration dictionary.
Returns
- The version number
Raises
ConfigurationError: If it can't find the current version