mypy

Optional static type checker for Python — catches type errors before runtime by analysing type annotations, with support for gradual typing

Visit mypy →
Tools & Libraries

mypy checks the type hints already in your code for consistency — a function typed as returning str that returns None on one path, or a call passing the wrong argument type, gets flagged before the code ever runs. It’s gradual by design: annotate as much or as little of a codebase as you want, unannotated code is simply skipped.

Adding type hints alone doesn’t catch anything without a checker actually reading them — see Python Type Hints: A Practical Guide for how the annotations and the checker fit together.