"How to Use Static Typing in Python with Type Hints, MyPy and Pydantic"
summary
Demonstrates using type hints together with MyPy and Pydantic to catch real errors: MyPy performs static analysis and flags incompatible assignments (e.g., assigning an int to a hinted str or appending an int to List[str]), while Pydantic validates at runtime, auto-coercing numeric strings into floats by default but raising ValidationError when conversion fails or when strict=True is set. Shows concrete class examples (Rectangle area/perimeter) and recommends incremental adoption and using Pydantic at system boundaries.
AI-written summary · about
chapters (6)
- 0:00Static typing in Python
- 6:09Type hints basics
- 11:59MyPy static checking
- 15:18Pydantic runtime validation
- 22:04Tools working together
- 26:19Getting started
related talks
24mStatic type-checking is dead, long live static type-checking in Python!
32mStatic Typing in Python
22mStatic Typing in Python
35mStatic Typing in Python
29mPython Type hints and how they can supercharge CS education.
46mHow to make a static type checker your best friend
29mStatic Typing in Python
28mMind the gap! Why static typing requires more than just adding annotations
