check
check(path='.', *, checks=None, skip=None, fail_on=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 to the package directory. Defaults to current directory.
checks : list[str] | None = None-
List of check names to run. If None, runs all enabled checks from configuration. Available checks: metadata, structure, tests, linting, typing, imports, license, docs.
skip : list[str] | None = None-
List of check names to skip, even if enabled in configuration.
fail_on : list[str] | None = None-
List of statuses to consider as failures when calling report.failed_on(). Defaults to [“error”]. Not used directly by this function but useful for the caller.
Returns
Examples
Basic usage - check current directory:
>>> from pycmdcheck import check
>>> report = check(".")
>>> report.passed
TrueRun only specific checks:
>>> report = check(".", checks=["metadata", "tests"])
>>> len(report.results)
2Skip certain checks:
>>> report = check(".", skip=["typing", "linting"])Iterate over results:
>>> for result in report.results:
... print(f"{result.status.symbol} {result.name}: {result.message}")
✓ metadata: Package metadata is valid
✓ tests: All tests passed