← All notes

mypy type-checks Python statically and can be adopted incrementally

Answer: You can install mypy using pip: python3 -m pip install mypy. Mypy requires Python 3.10 or later to run. After the install, run mypy program.py.

That command type-checks program.py and prints errors it finds. Mypy will type check your code statically. It checks for errors without ever running your code, just like a linter. You can still run the file with the Python interpreter if mypy reports errors.

The getting-started chapter introduces some core concepts of mypy, including function annotations, the typing module, and stub files. Existing unannotated code will most likely report little to no errors. That behavior is a feature, because it makes it easy to adopt mypy incrementally.

See also

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: mypy docs, Getting started, MIT (https://raw.githubusercontent.com/python/mypy/master/LICENSE); python/mypy (GitHub), Getting started (mypy source docs), MIT (https://raw.githubusercontent.com/python/mypy/master/LICENSE). Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: mypy docs, Getting started, MIT (https://raw.githubusercontent.com/python/mypy/master/LICENSE); python/mypy (GitHub), Getting started (mypy source docs), MIT (https://raw.githubusercontent.com/python/mypy/master/LICENSE).

Cite this

Permanent ID: iil:note:3jzsdypb

iinventedlight. 2026. "mypy type-checks Python statically and can be adopted incrementally." iinventedlight Library, iil:note:3jzsdypb, version of 2026-11-16. https://iinventedlight.com/library/notes/mypy-type-checker/. License: CC-BY-4.0.

@misc{iil_note_3jzsdypb,
  author = {{iinventedlight}},
  title = {{mypy type-checks Python statically and can be adopted incrementally}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-16},
  url = {https://iinventedlight.com/library/notes/mypy-type-checker/},
  note = {Permanent ID iil:note:3jzsdypb. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/mypy-type-checker.md.