checks.typing.TypingCheck

checks.typing.TypingCheck()

Run type checking tools on the package.

Executes a configurable static type checker to verify type annotations. Supports mypy (default) and pyright.

Attributes

name :

The check identifier (“typing”).

description :

Human-readable description of this check.

SUPPORTED_TOOLS :

List of supported type checking tools.

Configuration Options

tool (str): Type checker to use (“mypy” or “pyright”). Defaults to “mypy”. strict (bool): Whether to enable strict mode. Defaults to False. args (list[str]): Additional arguments to pass to the type checker.

Examples

Run type checking with default settings (mypy):

>>> from pathlib import Path
>>> check = TypingCheck()
>>> result = check.run(Path("."), {"enabled": True})
>>> result.name
'typing'

Configure to use pyright:

>>> config = {"enabled": True, "tool": "pyright"}
>>> result = check.run(Path("."), config)

Enable strict mode:

>>> config = {"enabled": True, "strict": True}
>>> result = check.run(Path("."), config)

Methods

Name Description
run Run type checking on the package.

run

checks.typing.TypingCheck.run(package_path, config)

Run type checking on the package.

Executes the configured type checker and collects any errors found. Errors are reported in the result details (limited to first 10).

Parameters

package_path : Path

Path to the package directory to check.

config : dict[str, Any]

Configuration dictionary with options: - tool (str): “mypy” or “pyright” (default: “mypy”) - strict (bool): Enable strict mode (default: False) - args (list[str]): Additional arguments for the checker

Returns

: CheckResult

A CheckResult with:

: CheckResult
  • OK status if no type errors found
: CheckResult
  • ERROR status if type errors found or checker fails
: CheckResult
  • SKIPPED status if the type checker is not installed