Mypy 1.3 released
10 May 2023: Mypy 1.3 was released. Read the blog post for the details. -Wesley Collin Wright
Mypy 1.2 released
6 Apr 2023: Mypy 1.2 was released. Read the blog post for the details. -Jukka Lehtosalo
Mypy 1.1.1 released
6 Mar 2023: Mypy 1.1.1 was released. Read the blog post for the details. -Max Murin
Mypy 1.0 released
6 Feb 2023: Mypy 1.0 was released. Read the blog post for the details. -Stas Ilinskiy
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.