bumpversion.config.files_legacy
This module handles the legacy config file format.
logger
python
logger = get_indented_logger(__name__)read_ini_file
python
def read_ini_file(file_path: Path) -> Dict[str, Any]Parse an INI file and return a dictionary of sections and their options.
Parameters
file_path: The path to the INI file.
Returns
- A dictionary of sections and their options.
update_ini_config_file
python
def update_ini_config_file(config_file: Union[str, Path], current_version: str, new_version: str, dry_run: bool = False) -> NoneUpdate the current_version key in the configuration file.
Instead of parsing and re-writing the config file with new information, it will use a regular expression to just replace the current_version value. The idea is it will avoid unintentional changes (like formatting) to the config file.
Parameters
config_file: The configuration file to explicitly use.current_version: The serialized current version.new_version: The serialized new version.dry_run: True if the update should be a dry run.