What it does
mypy is an optional static type checker for Python. Developers add annotations to functions and values, then run mypy to find type inconsistencies without executing the program. Its gradual approach allows a team to introduce annotations module by module, making it useful for Python codebases where data shapes cross many function boundaries.
Start with one annotated function instead of trying to type an entire Python project at once. The getting-started guide explains how annotations and the typing module give mypy information to check. For example, a function that accepts a list of integers and returns an integer can declare those types; mypy can then report a call that passes an incompatible value. A key choice is how much of the codebase is annotated. The guide states that unannotated functions are treated as dynamically typed by default, so they receive less checking unless stricter options are enabled. This allows gradual adoption, but it also means a clean result does not establish that all Python code has been checked. Use the command-line guide and configuration options to decide which modules and strictness level fit the project. mypy checks types before execution; it does not change Python's runtime behavior or validate external JSON by itself. The project is MIT-licensed, and its documentation describes mypy and mypyc as related components. For style and formatting checks, Ruff is a separate tool with a different purpose.
Strengths
- Type annotations allow mypy to find some inconsistent calls without executing the program.
- Its gradual approach supports adding type checking incrementally to an existing codebase.
- Official guides explain both getting started and command-line configuration.
Watch out for
- Unannotated functions are dynamically typed by default and receive limited checking unless stricter options are enabled.
Best for
- Python teams that want static checks for function inputs and return values.
- Existing codebases adopting type annotations module by module.
- Projects where maintainers want to catch type inconsistencies during development rather than at runtime.
Sources
- mypy - Optional Static Typing for Python (Oct 25, 2026)
- Getting started - mypy 2.4.0 documentation (Oct 25, 2026)
- The mypy command line (Oct 25, 2026)
- python/mypy (Oct 25, 2026)
- MIT License (Oct 25, 2026)
