Rock Solid Python with Python Typing Transcripts
Chapter: Tools Based on Typing
Lecture: Static Type Checkers
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
What do you do if your editor doesn't have this whole project inspection?
0:06
More importantly, what do you do if you want to put it into something like continuous integration
0:11
where it happens on every commit and every PR and that has nothing to do with an editor?
0:17
Well, there's this program, this tool called mypy that is officially under the Python organization.
0:24
organization here, you can see github.com/python/mypy, and it's an optional static typing checker for Python. So we talked about the gradual typing,
0:35
and if the type information is there, you can see if it links up, but if it's not there, then hey, don't worry about it.
0:42
After all, it's not like TypeScript. So this is one of the tools that makes that gradual optional typing possible.
0:51
So we're going to apply mypy to some code in our project in just a second.
0:55
But just to kind of round out that discussion before we do, there's also pyre, which is
1:01
from MetaFacebook that is a high performance type checker for Python 3.
1:06
And there's also pyright, which is a static type checker for Python, this time from Microsoft.
1:13
So check out all three of these, see which one makes you the most happy makes you feel
1:19
like is right for your project, but mypy being officially under Python, that gives it a little bit of a hat tip in my book anyway.
1:30
So we're going to use that one for our example.