project_config.config package

Configuration handler.

class project_config.config.Config(rootdir: str, path: Optional[str])[source]

Bases: object

Configuration wrapper.

Parameters
  • rootdir (str) – Project root directory.

  • path (str) – Path to the file from which the configuration will be loaded.

  • fetch_styles (bool) – Whether to fetch the styles in the styles loader.

  • validate_cli_config (bool) – Whether to validate the CLI configuration.

guess_from_cli_arguments(color: Optional[bool], reporter: Dict[str, Any], rootdir: str) Tuple[Any, Dict[str, Any], Any, bool][source]

Guess the final configuration merging file with CLI arguments.

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_filepath: str) str[source]

Initialize the configuration.

Parameters

config_filepath (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(custom_file_path: Optional[str] = None) Tuple[str, Any][source]

Read the configuration from a file.

Parameters

custom_file_path (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(filepath: str = 'pyproject.toml') Optional[Any][source]

Read the configuration from the pyproject.toml file.

Returns

None if not found, configuration data otherwise.

Return type

object

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

Validates the CLI configuration.

Parameters

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