What problem does it solve?
Writing Python code with clear, strong type hints reduces runtime errors and improves maintainability, especially when leveraging Python 3.12+ features like PEP 695 type parameters, TypedDict with Required/NotRequired/ReadOnly, Final, Self, and LiteralString.
Core Features & Use Cases
- Modern syntax support: unions with |, type aliases via type, and TypedDict enhancements for precise input shapes.
- Advanced type constructs: Final constants and Self type to support fluent APIs and safe recursive patterns.
- Safe SQL hints: LiteralString for restricting risky or dynamic SQL text.
- Use cases: applying strong typing in new projects, gradually typing existing code, or designing robust library APIs.
Quick Start
Create a small Python snippet that demonstrates a function using a union type, a TypedDict with a required field and an optional field, and a class method using Self. Run a type checker (e.g., mypy or Pyright) to observe type validations.