project_config.config package

Configuration handler.

class project_config.config.Config(args: Namespace, **kwargs: Any)[source]

Bases: FileConfig

Main configuration wrapper.

This class is the main configuration wrapper. It is used to load a configuration object from CLI arguments.

class project_config.config.FileConfig(rootdir: str, path: str | None, store_raw_config: bool = False)[source]

Bases: object

File configuration wrapper.

Stores the data of the project-config configuration defined in the file ‘.project-config.toml’ or equivalent. The configuration of the file is stored in the dict_ attribute.

load_style() None[source]
project_config.config._cache_string_to_seconds(cache_string: str) int[source]
project_config.config._validate_cli_config(config: dict[str, Any]) list[str][source]
project_config.config.initialize_config(config_fpath: str) str[source]

Initialize the configuration.

Parameters:

config_fpath (str) – Path to the file in which the configuration will be stored.

Returns:

Path to the configuration.

Return type:

str

project_config.config.read_config(rootdir: str, custom_fpath: Optional[str] = None) tuple[str, Any][source]

Read the configuration from a file.

Parameters:
  • rootdir (str) – Project root directory.

  • custom_fpath (str) – Custom configuration file path or None if the configuration must be read from one of the default configuration file paths.

Returns:

Configuration data.

Return type:

object

project_config.config.read_config_from_pyproject_toml(fpath: str) Any[source]

Read the configuration from the pyproject.toml file.

Returns:

None if not found, configuration data otherwise.

Return type:

object

project_config.config.reporter_from_config(config: Config) Any[source]

Instanciate a reporter from a configuration object.

Parameters:

config (Config) – Configuration object.

project_config.config.validate_cli_config(config_path: str, config: dict[str, Any]) dict[str, Any][source]

Validates the CLI configuration.

Parameters:
  • config_path (str) – Configuration file path.

  • config (dict) – Raw CLI configuration.

Returns:

CLI configuration data.

Return type:

object

project_config.config.validate_config(config_path: str, config: Any) None[source]

Validate a configuration.

Parameters:
  • config_path (str) – Configuration file path.

  • config (object) – Configuration data to validate.

project_config.config.validate_config_cache(config: Any) list[str][source]

Validate the cache field of a configuration object.

Parameters:

config (object) – Configuration data to validate.

Returns:

Found error messages.

Return type:

list

project_config.config.validate_config_style(config: Any) list[str][source]

Validate the style field of a configuration object.

Parameters:

config (object) – Configuration data to validate.

Returns:

Found error messages.

Return type:

list

Subpackages

Submodules