runner.run_checks
runner.run_checks(
package_path,
checks=None,
skip=None,
config=None,
parallel=True,
fail_fast=False,
*,
profile=None,
)Run checks on a package.
This is the core function that orchestrates check discovery and execution. It loads configuration, discovers available checks via entry points, and runs them either in parallel or sequentially.
Parameters
package_path : str | Path-
Path to the package directory to check. Can be a string or Path object. Will be resolved to an absolute path.
checks : list[str] | None = None-
List of specific check names to run. If None or empty, runs all checks that are enabled in the configuration, or the checks of
profilewhen one is given. The available check names are discovered dynamically via entry points; runpycmdcheck --listto see the current set. An unknown name is an error, a name given twice runs once, and a single string is read as one name. A deprecated check (imports) only runs when it is named here. A run that names no check and no profile logs a warning when[tool.pycmdcheck.checks]enables one, and leaves it out. skip : list[str] | None = None-
List of check names to skip, even if they would otherwise run. An unknown name is ignored with a logged warning, so skipping a plugin that is not installed keeps working.
config : dict[str, Any] | None = None-
Pre-loaded configuration dictionary. If None, configuration is loaded from the package’s pyproject.toml file.
parallel : bool = True-
Whether to run checks in parallel using threads. Defaults to True. Results come back in the same order either way.
fail_fast : bool = False-
Whether to stop after the first ERROR result. Checks that are already running finish, and checks that were not started are reported as SKIPPED. Defaults to False.
profile : str | None = None-
Name of a profile, as for
pycmdcheck --profile. Its options win over the configuration, and its check set is used whenchecksis not given.
Returns
Raises
: FileNotFoundError-
If
package_pathdoes not exist. : NotADirectoryError-
If
package_pathis not a directory. : ValueError-
If
profileis not a known profile name, or ifchecksholds a name that no registered check has.
Examples
Run all enabled checks:
>>> report = run_checks("/path/to/package")
>>> report.passed
TrueRun specific checks only:
>>> report = run_checks(".", checks=["metadata", "tests"])
>>> len(report.results)
2Run sequentially for debugging:
>>> report = run_checks(".", parallel=False)