Mypy is still in development. Most Python features are supported.
Mypy 0.620 released
13 July 2018: Mypy 0.620 was released. It adds support for dataclasses, improvements to overloads, better support for PEP 561 and several smaller improvements. Read the blog post for more details. -Ivan Levkivskyi
Mypy 0.610 released
8 June 2018: Mypy 0.610 was released. It adds support for
dmypy run and a host of other small improvements.
to see what's changed.
(Note that we're once again starting to link blog posts here.)
-Michael J. Sullivan
Dropbox releases PyAnnotate
15 November 2017: Dropbox has released an open source tool for automatically generating type annotations based on runtime type collection. See the blog post for details. -Guido van Rossum
For more mypy news see the mypy blog.
24 October 2017: We're increasing mypy's release frequency to about once per three weeks. We no longer will link here to each separate release blog post; just check the mypy blog for news. Two new versions, 0.530 and 0.540, were released since the last news item below. -Guido van Rossum
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.