Mypy 0.910 released
22 Jun 2021: Mypy 0.910 was released. This release includes the --non-interactive command-line option to install stubs without user interaction, plus other fixes and improvements. Python 3.5 is now deprecated. Read the blog post for the details. -Jukka Lehtosalo
Mypy 0.901 released
8 Jun 2021: Mypy 0.901 was released. This release moves third-party library stubs to stub packages, allowing newer stubs to be easily used without updating mypy. Mypy now supports pyproject.toml and type guards, and ships wheels for Apple Silicon. Plus, there are many other features and bug fixes. Read the blog post for the details. -Jukka Lehtosalo
The upcoming switch to modular typeshed in mypy 0.900
26 May 2021: The next mypy release will no longer bundle stubs for third-party libraries. Read this blog post if you are interested in what this means to mypy users and why we are doing this. -Jukka Lehtosalo
Mypy 0.812 released
19 February 2021: Mypy 0.812 was released. This release fixes a regression in module finding behavior and adds the --exclude flag for excluding certain paths when searching for modules. Read the blog post for the details. -Jukka Lehtosalo
def fib(n): a, b = 0, 1 while a < n: yield a a, b = b, a+b
def fib(n: int) -> Iterator[int]: a, b = 0, 1 while a < n: yield a a, b = b, a+b
Migrate existing code to static typing, a function at a time. You can freely mix static and dynamic typing within a program, within a module or within an expression. No need to give up dynamic typing — use static typing when it makes sense. Often just adding function signatures gives you statically typed code. Mypy can infer the types of other variables.
Mypy type checks programs that have type annotations conforming to PEP 484. Getting started is easy if you know Python. The aim is to support almost all Python language constructs in mypy.
Mypy has a powerful, modern type system with features such as bidirectional type inference, generics, callable types, abstract base classes, multiple inheritance and tuple types.
Many commonly used libraries have stubs (statically typed interface definitions) that allow mypy to check that your code uses the libraries correctly.