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 --list to 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 --profile option. Its options win over the configuration, and its check set is used when checks is not given.

Returns

: Report

A Report object containing all check results. Use report.passed to

: Report

check if all checks passed, or iterate report.results for details.

Raises

: FileNotFoundError

If path does not exist.

: NotADirectoryError

If path is not a directory.

: ValueError

If profile is not a known profile name, or if checks holds a name that no registered check has.

Examples

Basic usage - check current directory:

>>> from pycmdcheck import check
>>> report = check(".")
>>> report.passed
True

Run only specific checks:

>>> report = check(".", checks=["metadata", "tests"])