You’ve heard about type annotations, you know they help reduce bugs and improve documentation especially for large codebases, and you’ve attended an introductory talk or read a tutorial about using them. But how do you get started using them with your big, existing codebase? How do you make sure your colleagues will be annotating new code they write - or existing code they’re changing? And how do you get around some of the issues you might run into when using the still-beta type checker mypy on your codebase?
This talk will start where the typical introductory Python type annotation talks end and discuss the real-world challenges when starting to annotate types with an existing codebase of tens or hundreds of thousands of lines of code. I’ll walk you through best practices learned from doing just that at Yelp, telling you about some of the roadblocks we hit (and how we got past them).
We’ll also take a look at: - how you can get the most out of type annotations even with non-annotated third-party libraries - how to deal with code patterns that currently don’t always work well with annotations - when the only way to get proper type checking is through refactoring your code.
If you like this website, please upvote my Awesome Python pull request.