check
check(
path='.',
*,
checks=None,
skip=None,
config=None,
parallel=True,
fail_fast=False,
profile=None,
)Check a Python package for quality issues.
This is the main entry point for programmatic use of pycmdcheck. It discovers available checks via entry points, loads configuration from pyproject.toml, and runs the enabled checks.
Parameters
path : str | Path = '.'-
Path to the package directory. Defaults to current directory.
checks : list[str] | None = None-
Names of checks to run. If None, runs all enabled checks from configuration. The available check names are discovered dynamically via entry points; run
pycmdcheck --listto see the current set. An unknown name is an error. A deprecated check (imports) only runs when it is named here. skip : list[str] | None = None-
List of check names to skip, even if enabled in configuration. An unknown name is ignored with a logged warning.
config : dict[str, Any] | None = None-
Pre-loaded configuration dictionary. If None, configuration is loaded from the package’s pyproject.toml.
parallel : bool = True-
Whether to run checks in parallel. Defaults to True.
fail_fast : bool = False-
Whether to stop after the first ERROR. Defaults to False.
profile : str | None = None-
Name of a profile (see
pycmdcheck --list-profiles), with the same meaning as the--profileoption. Its options win over the configuration, and its check set is used whenchecksis not given.
Returns
Raises
: FileNotFoundError-
If
pathdoes not exist. : NotADirectoryError-
If
pathis not a directory. : ValueError-
If
profileis not a known profile name, or ifchecksholds a name that no registered check has.
Examples
Basic usage - check current directory:
>>> from pycmdcheck import check
>>> report = check(".")
>>> report.passed
TrueRun only specific checks:
>>> report = check(".", checks=["metadata", "tests"])