config.load_config

config.load_config(package_path)

Load pycmdcheck configuration from pyproject.toml.

Reads the [tool.pycmdcheck] section from the package’s pyproject.toml and merges it with default configuration. If no pyproject.toml exists or it doesn’t contain pycmdcheck configuration, returns defaults.

Parameters

package_path : Path

Path to the package directory containing pyproject.toml.

Returns

: dict[str, Any]

Configuration dictionary with the following structure:

: dict[str, Any]
  • fail_on: The status to fail on, in a list (default: [“error”]). The command line reads it as a threshold, so “warning” also fails on errors.
: dict[str, Any]
  • checks: Dictionary of check configurations

Examples

>>> from pathlib import Path
>>> config = load_config(Path("."))
>>> config["fail_on"]
['error']
>>> config["checks"]["tests"]["runner"]
'pytest'