Skip to content

Types

📖 This page describes the invoke_tasklib.typecheck module.

Overview

Task Behavior
types.check Checks type hints with ty (read-only)

Usage

invoke types.check

This runs ty check, or the checker of tasklib.types.checker in the config: pyright or mypy (mypy must be a dependency of the project).

Pass --complete to also run pyright after the checker (slower, more thorough; nothing more if the checker is pyright):

invoke types.check --complete

--args is passed to the checker only, and --pyright-args to pyright only (it is used with --complete); --paths is passed to both tools (see Passing Arguments to the Tools):

invoke types.check --complete --args "--python-version 3.12" --pyright-args "--pythonversion 3.12"

Without --paths, ty checks the project and pyright the files of its own include setting (in pyproject.toml or pyrightconfig.json), so the two tools can look at different files. Set the same files in both, or pass --paths, to keep them aligned.

See Also