Skip to content

files

Contains methods for finding and reading configuration files.

Classes

Functions

find_config_file

find_config_file(
    explicit_file: Union[str, Path, None] = None
) -> Union[Path, None]

Find the configuration file, if it exists.

If no explicit configuration file is passed, it will search in several files to find its configuration.

Parameters:

explicit_file

The configuration file to explicitly use.

TYPE: Union[str, Path, None]

DEFAULT: None

Returns:

Union[Path, None]

The configuration file path

read_config_file

read_config_file(
    config_file: Union[str, Path, None] = None
) -> Dict[str, Any]

Read the configuration file, if it exists.

If no explicit configuration file is passed, it will search in several files to find its configuration.

Parameters:

config_file

The configuration file to explicitly use.

TYPE: Union[str, Path, None]

DEFAULT: None

Returns:

Dict[str, Any]

A dictionary of read key-values

read_toml_file

read_toml_file(file_path: Path) -> Dict[str, Any]

Parse a TOML file and return the bumpversion section.

Parameters:

file_path

The path to the TOML file.

TYPE: Path

Returns:

dict

A dictionary of the bumpversion section.

TYPE: Dict[str, Any]

update_config_file

update_config_file(
    config_file: Union[str, Path],
    config: Config,
    current_version: Version,
    new_version: Version,
    context: MutableMapping,
    dry_run: bool = False,
) -> None

Update the current_version key in the configuration file.

Parameters:

config_file

The configuration file to explicitly use.

TYPE: Union[str, Path]

config

The configuration to use.

TYPE: Config

current_version

The current version.

TYPE: Version

new_version

The new version.

TYPE: Version

context

The context to use for serialization.

TYPE: MutableMapping

dry_run

True if the update should be a dry run.

TYPE: bool

DEFAULT: False