conference logo

Playlist "Swiss Python Summit 2022"

Static type checking with mypy

Michal Gutowski

Python is a dynamic language, which gives its users a lot of power. But, as we know, with great power comes great responsibility. Fortunately for us, we can incorporate a tool in our workflows - Mypy. Mypy allows developers to add a layer of safety in their programs - static type annotations. During my talk, I will show you why PEP484 type annotations can be helpful, how to check them, and gradually introduce them in your codebase. Additionally, I want to show some tricks to make the dynamic parts safer. Finally, I will also show situations where Mypy falls short and how to avoid them.

Python is a dynamic language, which gives its users a lot of power. But, as we know, with great power comes great responsibility. Fortunately for us, we can incorporate a tool in our workflows - Mypy. Mypy allows developers to add a layer of safety in their programs - static type annotations. During my talk, I will show you why PEP484 type annotations can be helpful, how to check them, and gradually introduce them in your codebase. Additionally, I want to show some tricks to make the dynamic parts safer. Finally, I will also show situations where Mypy falls short and how to avoid them.