Static Typing with Python

Tutorials

Guides

Reference

See also

The documentation athttps://mypy.readthedocs.io/ is relatively accessibleand complete.

Specification

Indices and tables

Discussions and Support

Typing-related Tools

Type Checkers

Development Environments

  • PyCharm, an IDE that supportstype stubs both for type checking and code completion.

  • Visual Studio Code, a code editor thatsupports type checking using mypy, pyright, or thePylanceextension.

Linters and Formatters

  • black, a code formatter with support fortype stub files.

  • flake8-pyi, a plugin for theflake8 linter that adds support for typestubs.

  • ruff, a linter built for speed, with support formost of theflake8-pyi rules.

Type-Hint and Stub Integration

  • autotyping, a tool whichinfers simple types from their context and inserts them as inline type-hints.

  • merge-pyi,a thin wrapper aroundApplyTypeAnnotationsVisitor fromlibCST that integrates .pyisignatures as inline type-hints in Python source code.

Typing PEPs

Seehttps://peps.python.org/topic/typing for a list of all typing-related PEPs.