Coding

mypy – static type checker for Python

Mypy is a static type checker for Python that helps developers identify programming errors before executing their code. It examines type annotations and how values are used throughout a program, reporting inconsistencies that might otherwise be discovered only during testing or production use.

The application is designed around gradual typing. Developers can introduce annotations into selected parts of a program while leaving other areas dynamically typed, allowing type checking to be adopted without rewriting an entire codebase.

Mypy is particularly valuable in larger projects where interfaces between modules and libraries can become difficult to manage. By checking expectations about function arguments, return values and object types, it helps make program behaviour easier to reason about while providing additional safeguards during refactoring.

This is free and open source software.

Key Features

  • Supports standard Python type annotations, generics, union types and callable types.
  • Provides structural subtyping through protocols, allowing compatibility without explicit inheritance.
  • Offers configurable strict checking modes and fine-grained control over diagnostic categories.
  • Infers types where possible, reducing the need for annotations on every local variable.
  • Uses incremental caching to avoid repeatedly analysing unchanged modules.
  • Includes a long-running daemon with fine-grained dependency tracking for faster repeated checks.
  • Supports third-party type stubs for libraries that do not provide their own annotations.
  • Offers a plugin system for libraries with specialised typing behaviour.
  • Integrates with compatible development editors and automated checking pipelines.

Website: github.com/python/mypy
Support:
Developer: Jukka Lehtosalo and contributors
License: MIT License

mypy is written in Python. Learn Python with our recommended free books and free tutorials.


Related Software

Python Linters
RuffExtremely fast Python linter and code formatter
tyFast Python type checker
MypyStatic type checker for Python
BanditFind security issues in Python code
PylintStatic code analyser
wemake-python-styleguideFlake8 plugin
TachEnforces module dependencies and architectural boundaries
pycodestyleCheck Python code against style conventions in PEP 8
PyflakesChecks Python source files for errors
VultureFind dead code
PyreflyFast type checker and language server
Flake8Wrapper around PyFlakes and pycodestyle
BeartypeNear-real-time hybrid runtime-static type-checker
RadonComputes various metrics from Python code
PyrightFull-featured, standards-compliant static type checker
cython-lintLint Cython files
basedpyrightFork of pyright
RefurbModernize Python codebases
PylamaCode audit tool for Python
ProspectorBrings together the functionality of other Python analysis tools
deptryCheck for dependency issues
FixitHighly configurable linting framework
complexipyMeasures cognitive complexity in Python code
ZubanHigh-performance Python type checker and language server
PyromaRates how well a Python project compiles
pydoclintPython docstring linter
AridFast duplicate code detection for Python projects

Read our verdict in the software roundup.


Best Free and Open Source Software LinuxLinks helps you discover the best free and open source software for Linux. Explore our extensive collection of recommended applications, including alternatives to popular proprietary software.

We also publish software reviews, Linux tutorials, hardware reviews, free programming books and articles covering the wider open source community. Browse our Linux resources to discover more.

Know a useful free and open source Linux application we haven't covered? Suggest a program for inclusion.

Has your software been featured on LinuxLinks? Display one of our Featured on LinuxLinks badges on your website or GitHub README.
Subscribe

Please read our Comment Policy before commenting.

Notify of
guest
0 Comments
Oldest
Newest Most Voted