Sebastian Rittau | 651cb58 | 2021-08-24 23:44:46 +0200 | [diff] [blame] | 1 | ************************* |
| 2 | Static Typing with Python |
| 3 | ************************* |
Sebastian Rittau | ae26334 | 2021-12-22 17:00:56 +0100 | [diff] [blame] | 4 | |
| 5 | .. Introduction |
| 6 | .. ============ |
Redowan Delowar | 9169152 | 2022-04-11 08:27:03 +0600 | [diff] [blame] | 7 | .. |
Stephen Rosen | 9c7e30b | 2021-12-22 05:40:33 -0500 | [diff] [blame] | 8 | .. .. toctree:: |
| 9 | .. :maxdepth: 2 |
Redowan Delowar | 9169152 | 2022-04-11 08:27:03 +0600 | [diff] [blame] | 10 | .. |
Stephen Rosen | 9c7e30b | 2021-12-22 05:40:33 -0500 | [diff] [blame] | 11 | .. source/introduction |
Shannon Zhu | 80cfad0 | 2021-12-21 10:21:27 -0800 | [diff] [blame] | 12 | |
Sebastian Rittau | ae26334 | 2021-12-22 17:00:56 +0100 | [diff] [blame] | 13 | Guides |
| 14 | ====== |
| 15 | |
Shannon Zhu | 80cfad0 | 2021-12-21 10:21:27 -0800 | [diff] [blame] | 16 | .. toctree:: |
Sebastian Rittau | ae26334 | 2021-12-22 17:00:56 +0100 | [diff] [blame] | 17 | :maxdepth: 2 |
| 18 | |
| 19 | source/guides |
| 20 | |
| 21 | Reference |
| 22 | ========= |
| 23 | |
| 24 | .. toctree:: |
| 25 | :maxdepth: 2 |
Shannon Zhu | 80cfad0 | 2021-12-21 10:21:27 -0800 | [diff] [blame] | 26 | |
| 27 | source/reference |
Shannon Zhu | 2de0a93 | 2021-06-03 18:53:01 -0700 | [diff] [blame] | 28 | |
Shannon Zhu | 2de0a93 | 2021-06-03 18:53:01 -0700 | [diff] [blame] | 29 | Indices and tables |
| 30 | ================== |
| 31 | |
| 32 | * :ref:`genindex` |
Shannon Zhu | 2de0a93 | 2021-06-03 18:53:01 -0700 | [diff] [blame] | 33 | * :ref:`search` |
Sebastian Rittau | 9e1e447 | 2021-08-23 23:20:19 +0200 | [diff] [blame] | 34 | |
Sebastian Rittau | c7c30c8 | 2021-08-24 08:40:48 +0200 | [diff] [blame] | 35 | Discussions and Support |
| 36 | ======================= |
| 37 | |
| 38 | * `User help forum <https://github.com/python/typing/discussions>`_ |
| 39 | * `User chat on Gitter <http://gitter.im/python/typing>`_ |
| 40 | * `Developer mailing list <https://mail.python.org/archives/list/typing-sig@python.org/>`_ |
| 41 | |
Sebastian Rittau | 9e1e447 | 2021-08-23 23:20:19 +0200 | [diff] [blame] | 42 | Typing-related Tools |
| 43 | ==================== |
| 44 | |
| 45 | Type Checkers |
| 46 | ------------- |
| 47 | |
| 48 | * `mypy <http://mypy-lang.org/>`_, the reference implementation for type |
| 49 | checkers. Supports Python 2 and 3. |
| 50 | * `pyre <https://pyre-check.org/>`_, written in OCaml and optimized for |
| 51 | performance. Supports Python 3 only. |
| 52 | * `pyright <https://github.com/microsoft/pyright>`_, a type checker that |
| 53 | emphasizes speed. Supports Python 3 only. |
| 54 | * `pytype <https://google.github.io/pytype/>`_, checks and infers types for |
| 55 | unannotated code. Supports Python 2 and 3. |
| 56 | |
| 57 | Development Environments |
| 58 | ------------------------ |
| 59 | |
Numerlor | 345e892 | 2021-11-27 07:42:08 -0800 | [diff] [blame] | 60 | * `PyCharm <https://www.jetbrains.com/pycharm/>`_, an IDE that supports |
Sebastian Rittau | 9e1e447 | 2021-08-23 23:20:19 +0200 | [diff] [blame] | 61 | type stubs both for type checking and code completion. |
| 62 | * `Visual Studio Code <https://code.visualstudio.com/>`_, a code editor that |
| 63 | supports type checking using mypy, pyright, or the |
| 64 | `Pylance <https://marketplace.visualstudio.com/items?itemName=ms-python.vscode-pylance>`_ |
| 65 | extension. |
| 66 | |
| 67 | Linters and Formatters |
| 68 | ---------------------- |
| 69 | |
| 70 | * `black <https://black.readthedocs.io/>`_, a code formatter with support for |
| 71 | type stub files. |
| 72 | * `flake8-pyi <https://github.com/ambv/flake8-pyi>`_, a plugin for the |
| 73 | `flake8 <https://flake8.pycqa.org/>`_ linter that adds support for type |
| 74 | stubs. |
Jelle Zijlstra | 37aa31f | 2021-11-19 00:46:35 -0800 | [diff] [blame] | 75 | |
| 76 | Typing PEPs |
| 77 | =========== |
| 78 | |
Sebastian Rittau | fefa535 | 2021-11-19 14:16:21 +0100 | [diff] [blame] | 79 | * `PEP 483 <https://www.python.org/dev/peps/pep-0483/>`_, background on type hints |
| 80 | * `PEP 484 <https://www.python.org/dev/peps/pep-0484/>`_, type hints |
| 81 | * `PEP 526 <https://www.python.org/dev/peps/pep-0526/>`_, variable annotations and ``ClassVar`` |
| 82 | * `PEP 544 <https://www.python.org/dev/peps/pep-0544/>`_, ``Protocol`` |
| 83 | * `PEP 561 <https://www.python.org/dev/peps/pep-0561/>`_, distributing typed packages |
| 84 | * `PEP 563 <https://www.python.org/dev/peps/pep-0563/>`_, ``from __future__ import annotations`` |
| 85 | * `PEP 585 <https://www.python.org/dev/peps/pep-0585/>`_, subscriptable generics in the standard library |
| 86 | * `PEP 586 <https://www.python.org/dev/peps/pep-0586/>`_, ``Literal`` |
| 87 | * `PEP 589 <https://www.python.org/dev/peps/pep-0589/>`_, ``TypedDict`` |
| 88 | * `PEP 591 <https://www.python.org/dev/peps/pep-0591/>`_, ``Final`` |
| 89 | * `PEP 593 <https://www.python.org/dev/peps/pep-0593/>`_, ``Annotated`` |
| 90 | * `PEP 604 <https://www.python.org/dev/peps/pep-0604/>`_, union syntax with ``|`` |
| 91 | * `PEP 612 <https://www.python.org/dev/peps/pep-0612/>`_, ``ParamSpec`` |
| 92 | * `PEP 613 <https://www.python.org/dev/peps/pep-0613/>`_, ``TypeAlias`` |
| 93 | * `PEP 646 <https://www.python.org/dev/peps/pep-0646/>`_, variadic generics and ``TypeVarTuple`` |
| 94 | * `PEP 647 <https://www.python.org/dev/peps/pep-0647/>`_, ``TypeGuard`` |
Redowan Delowar | 9169152 | 2022-04-11 08:27:03 +0600 | [diff] [blame] | 95 | * `PEP 655 <https://www.python.org/dev/peps/pep-0655/>`_, ``Required`` and ``NotRequired`` |
Jelle Zijlstra | a45c7e9 | 2022-02-09 18:16:06 -0800 | [diff] [blame] | 96 | * `PEP 673 <https://www.python.org/dev/peps/pep-0673/>`_, ``Self`` |
Redowan Delowar | 9169152 | 2022-04-11 08:27:03 +0600 | [diff] [blame] | 97 | * `PEP 675 <https://www.python.org/dev/peps/pep-0675/>`_, ``LiteralString`` |
| 98 | * `PEP 677 <https://www.python.org/dev/peps/pep-0677/>`_ (rejected), callable type syntax |
Jelle Zijlstra | c1db137 | 2022-02-09 18:18:43 -0800 | [diff] [blame] | 99 | * `PEP 681 <https://www.python.org/dev/peps/pep-0681/>`_ (draft), ``@dataclass_transform()`` |