Static Typing with Python¶
Guides¶
Reference¶
See also
The documentation at https://mypy.readthedocs.io/ is relatively accessible and complete. Particularly refer to the “Type System Reference” section of the docs – since the Python typing system is standardised via PEPs, this information should apply to most Python type checkers.
Indices and tables¶
Discussions and Support¶
Typing PEPs¶
https://peps.python.org/topic/typing
PEP 482, literature overview on type hints
PEP 483, background on type hints
PEP 484, type hints
PEP 526, variable annotations and
ClassVar
PEP 544,
Protocol
PEP 561, distributing typed packages
PEP 563,
from __future__ import annotations
PEP 585, subscriptable generics in the standard library
PEP 586,
Literal
PEP 589,
TypedDict
PEP 591,
Final
PEP 593,
Annotated
PEP 604, union syntax with
|
PEP 612,
ParamSpec
PEP 613,
TypeAlias
PEP 646, variadic generics and
TypeVarTuple
PEP 647,
TypeGuard
PEP 649 (draft),
from __future__ import co_annotations
PEP 655,
Required
andNotRequired
PEP 673,
Self
PEP 675,
LiteralString
PEP 677 (rejected),
(int, str) -> bool
callable type syntaxPEP 681
@dataclass_transform()
PEP 688
Buffer
PEP 692
Unpack[TypedDict]
for**kwargs
PEP 695
class Class[T]:
type parameter syntaxPEP 696 (draft), defaults for type variables
PEP 698
@override
PEP 702 (draft),
@deprecated()
PEP 705 (draft),
TypedMapping