| ************************* |
| Static Typing with Python |
| ************************* |
| |
| .. toctree:: |
| :maxdepth: 2 |
| :caption: Contents: |
| |
| typing Module Documentation <https://docs.python.org/3/library/typing.html> |
| source/libraries |
| source/stubs |
| |
| |
| Indices and tables |
| ================== |
| |
| * :ref:`genindex` |
| * :ref:`search` |
| |
| |
| Discussions and Support |
| ======================= |
| |
| * `User help forum <https://github.com/python/typing/discussions>`_ |
| * `User chat on Gitter <http://gitter.im/python/typing>`_ |
| * `Developer mailing list <https://mail.python.org/archives/list/[email protected]/>`_ |
| |
| Typing-related Tools |
| ==================== |
| |
| Type Checkers |
| ------------- |
| |
| * `mypy <http://mypy-lang.org/>`_, the reference implementation for type |
| checkers. Supports Python 2 and 3. |
| * `pyre <https://pyre-check.org/>`_, written in OCaml and optimized for |
| performance. Supports Python 3 only. |
| * `pyright <https://github.com/microsoft/pyright>`_, a type checker that |
| emphasizes speed. Supports Python 3 only. |
| * `pytype <https://google.github.io/pytype/>`_, checks and infers types for |
| unannotated code. Supports Python 2 and 3. |
| |
| Development Environments |
| ------------------------ |
| |
| * `PyCharm <https://www.jetbrains.com/de-de/pycharm/>`_, an IDE that supports |
| type stubs both for type checking and code completion. |
| * `Visual Studio Code <https://code.visualstudio.com/>`_, a code editor that |
| supports type checking using mypy, pyright, or the |
| `Pylance <https://marketplace.visualstudio.com/items?itemName=ms-python.vscode-pylance>`_ |
| extension. |
| |
| Linters and Formatters |
| ---------------------- |
| |
| * `black <https://black.readthedocs.io/>`_, a code formatter with support for |
| type stub files. |
| * `flake8-pyi <https://github.com/ambv/flake8-pyi>`_, a plugin for the |
| `flake8 <https://flake8.pycqa.org/>`_ linter that adds support for type |
| stubs. |
| |
| Typing PEPs |
| =========== |
| |
| * `PEP 483 <https://www.python.org/dev/peps/pep-0483/>`, background on type hints |
| * `PEP 484 <https://www.python.org/dev/peps/pep-0484/>`, type hints |
| * `PEP 526 <https://www.python.org/dev/peps/pep-0526/>`, variable annotations and ``ClassVar`` |
| * `PEP 544 <https://www.python.org/dev/peps/pep-0544/>`, ``Protocol`` |
| * `PEP 561 <https://www.python.org/dev/peps/pep-0561/>`, distributing typed packages |
| * `PEP 563 <https://www.python.org/dev/peps/pep-0563/>`, ``from __future__ import annotations`` |
| * `PEP 585 <https://www.python.org/dev/peps/pep-0585/>`, subscriptable generics in the standard library |
| * `PEP 586 <https://www.python.org/dev/peps/pep-0586/>`, ``Literal`` |
| * `PEP 589 <https://www.python.org/dev/peps/pep-0589/>`, ``TypedDict`` |
| * `PEP 591 <https://www.python.org/dev/peps/pep-0591/>`, ``Final`` |
| * `PEP 593 <https://www.python.org/dev/peps/pep-0593/>`, ``Annotated`` |
| * `PEP 604 <https://www.python.org/dev/peps/pep-0604/>`, union syntax with ``|`` |
| * `PEP 612 <https://www.python.org/dev/peps/pep-0612/>`, ``ParamSpec`` |
| * `PEP 613 <https://www.python.org/dev/peps/pep-0613/>`, ``TypeAlias`` |
| * `PEP 646 <https://www.python.org/dev/peps/pep-0646/>`, variadic generics and ``TypeVarTuple`` |
| * `PEP 647 <https://www.python.org/dev/peps/pep-0647/>`, ``TypeGuard`` |
| * `PEP 655 <https://www.python.org/dev/peps/pep-0655/>` (draft), ``Required`` and ``NotRequired`` |
| * `PEP 673 <https://www.python.org/dev/peps/pep-0673/>` (draft), ``Self`` |