Mypy: Optional Static Typing for Python

Wasim Thabraze (~waseem18)




Large Python codebases can be hard to maintain. If we make it easier to understand our code bases, we make everyone more productive and help each other write fewer bugs. Static typing is one of remedies that can improve readability and maintainability of the code.

That's why Python now features optional static typing as described in PEP-484, implemented as Mypy.

Mypy is an experimental variant of Python that let's you add optional type annotations to type check your Python code. And it works great on both Python 2.7 and 3.3+.

Adopting static typing is easier that you think, you can start on a small set of code and move on to bigger pieces.

In this talk I'll share about,

  1. PEP-484 and Introduction of type annotations in Python 3.5 (6 min)
  2. Use cases of Mypy and how to use it with Python 2 and 3 (8 min)
  3. Project typeshed and how to leverage it (3 min)
  4. Lessons I learned by type hinting projects like Texttable and Twine (6 min)


  1. Knowledge of Python
  2. Difference between dynamic and statically typed languages

Content URLs:

Slides : (WIP)

Stub file for the project Texttable :

Mypy travis job configuration :

Article on Medium about Mypy :

Speaker Info:

Wasim is a Senior Software Engineer at Zemoso Labs, Hyderabad. He's an open source fanatic who loves to create meaningful software and contribute to open source projects.

Some of his contributions are included in projects like Sendgrid, Warehouse, Twine and Hazelcast.

Apart from programming he also tweets.

You can find him interesting on his GitHub profile.

Speaker Links:

Portfolio :

GitHub :

Twitter: imwaseem18

LinkedIn :

Id: 774
Section: Core python and Standard library
Type: Talks
Target Audience: Intermediate
Last Updated: