discovery.discover_checks

discovery.discover_checks()

Discover all registered checks via entry points.

Scans the pycmdcheck.checks entry point group and loads all registered check classes. Built-in checks are registered in the package’s pyproject.toml, and third-party packages can register additional checks.

A plugin that fails to load, for any reason, is skipped with a logged warning, and discovery continues with the other checks. The names of the built-in checks, deprecated ones included, are reserved: a plugin that registers one of them is skipped with a warning, so a plugin cannot replace a built-in check.

Returns

: dict[str, type[Check]]

A dictionary mapping check names (strings) to check classes, sorted

: dict[str, type[Check]]

by name. The check classes implement the Check protocol from

: dict[str, type[Check]]

pycmdcheck.checks.base.

Examples

Discover all available checks (returns a name -> class mapping):

>>> checks = discover_checks()
>>> isinstance(checks, dict)
True

Get a specific check class (requires the package to be installed so its entry points are registered):

>>> MetadataCheck = discover_checks()["metadata"]
>>> MetadataCheck().name
'metadata'