Skip to main content
Loading page…
Python Mastery
Chapter 18
Lesson 2 of 3
Static Typing with mypy and pyright
Contents
Notes
Tutor
Concept
Installing and Running mypy
Loading activity…
Previous
1 / 8
Continue
Contents
Notes
Discussion
Tutor
20 min
8 activities
0 of 8 done
In this lesson
1
Installing and Running mypy
2
Reading a Real mypy Error
3
Gradual Typing and the Role of Any
4
# type: ignore — Use Sparingly
5
Quick Check: What Does Any Do?
6
mypy Errors: Identify and Fix
7
Editor Integration: The Real Day-to-Day Payoff
8
Reflect: When Would You Reach for # type: ignore?
Objectives
Install mypy and run it against a Python file or package
Read and interpret common mypy error messages and know how to fix them
Explain gradual typing and the role of `Any` as a typing escape hatch
Use `# type: ignore` sparingly and correctly, and configure basic mypy settings
Further reading
mypy documentation
pyright documentation
Chapter 18 · Type Hints & Static Typing
Type Hints Basics
Static Typing with mypy and pyright
Generics, Protocols & Advanced Typing
Previous: Type Hints Basics
Next: Generics, Protocols & Advanced Typing