Skip to content

Commit 9e1e447

Browse files
authored
Move the typing tools section to the index (#847)
* Enable the intersphinx extension for linking to Python documentation. * Use inline links instead of footnotes for links to projects and modules. * Mention that typed_ast is available on PyPI.
1 parent 82b3940 commit 9e1e447

File tree

3 files changed

+42
-58
lines changed

3 files changed

+42
-58
lines changed

docs/conf.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,6 @@
5050
# relative to this directory. They are copied after the builtin static files,
5151
# so a file named "default.css" will overwrite the builtin "default.css".
5252
html_static_path = []
53+
54+
extensions = ['sphinx.ext.intersphinx']
55+
intersphinx_mapping = {'python': ('https://docs.python.org/3', None)}

docs/index.rst

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,37 @@ Indices and tables
1818

1919
* :ref:`genindex`
2020
* :ref:`search`
21+
22+
Typing-related Tools
23+
====================
24+
25+
Type Checkers
26+
-------------
27+
28+
* `mypy <http://mypy-lang.org/>`_, the reference implementation for type
29+
checkers. Supports Python 2 and 3.
30+
* `pyre <https://pyre-check.org/>`_, written in OCaml and optimized for
31+
performance. Supports Python 3 only.
32+
* `pyright <https://github.com/microsoft/pyright>`_, a type checker that
33+
emphasizes speed. Supports Python 3 only.
34+
* `pytype <https://google.github.io/pytype/>`_, checks and infers types for
35+
unannotated code. Supports Python 2 and 3.
36+
37+
Development Environments
38+
------------------------
39+
40+
* `PyCharm <https://www.jetbrains.com/de-de/pycharm/>`_, an IDE that supports
41+
type stubs both for type checking and code completion.
42+
* `Visual Studio Code <https://code.visualstudio.com/>`_, a code editor that
43+
supports type checking using mypy, pyright, or the
44+
`Pylance <https://marketplace.visualstudio.com/items?itemName=ms-python.vscode-pylance>`_
45+
extension.
46+
47+
Linters and Formatters
48+
----------------------
49+
50+
* `black <https://black.readthedocs.io/>`_, a code formatter with support for
51+
type stub files.
52+
* `flake8-pyi <https://github.com/ambv/flake8-pyi>`_, a plugin for the
53+
`flake8 <https://flake8.pycqa.org/>`_ linter that adds support for type
54+
stubs.

docs/stubs.rst

Lines changed: 5 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,18 @@ Python 3.8, although type checker authors are encouraged to support it.
7171
Stubs are treated as if ``from __future__ import annotations`` is enabled.
7272
In particular, built-in generics and forward references can be used.
7373

74-
Starting with Python 3.8, the ast_ module from the standard library supports
74+
Starting with Python 3.8, the :py:mod:`ast` module from the standard library supports
7575
all syntax features required by this PEP. Older Python versions can use the
76-
typed_ast_ package, which also supports Python 3.7 syntax and ``# type``
76+
`typed_ast <https://pypi.org/project/typed-ast/>`_ package from the
77+
Python Package Index, which also supports Python 3.7 syntax and ``# type``
7778
comments.
7879

7980
Distribution
8081
============
8182

8283
Type stubs can be distributed with or separately from the implementation;
83-
see PEP 561 [#pep561]_ for more information. The typeshed_ project
84+
see PEP 561 [#pep561]_ for more information. The
85+
`typeshed <https://github.com/python/typeshed>`_ project
8486
includes stubs for Python's standard library and several third-party
8587
packages. These are usually distributed with type checkers and do not
8688
require separate installation.
@@ -989,36 +991,6 @@ No::
989991
Point = NamedTuple("Point", [('x', float), ('y', float)])
990992
Thing = TypedDict("Thing", {'stuff': str, 'index': int})
991993

992-
Existing Tools
993-
==============
994-
995-
Type Checkers
996-
-------------
997-
998-
* mypy [#mypy]_, the reference implementation for type checkers.
999-
Supports Python 2 and 3.
1000-
* pyre [#pyre]_, written in OCaml and optimized for performance.
1001-
Supports Python 3 only.
1002-
* pyright [#pyright]_, a type checker that emphasizes speed. Supports Python 3
1003-
only.
1004-
* pytype [#pytype]_, checks and infers types for unannotated code.
1005-
Supports Python 2 and 3.
1006-
1007-
Development Environments
1008-
------------------------
1009-
1010-
* PyCharm [#pycharm]_, an IDE that supports type stubs both for type
1011-
checking and code completion.
1012-
* Visual Studio Code [#vscode]_, a code editor that supports type
1013-
checking using mypy, pyright, or the Pylance [#pylance]_ extension.
1014-
1015-
Linters and Formatters
1016-
----------------------
1017-
1018-
* black [#black]_, a code formatter with support for type stub files.
1019-
* flake8-pyi [#flake8-pyi]_, a plugin for the flake8 linter [#flake8]_ that adds support for
1020-
type stubs.
1021-
1022994
References
1023995
==========
1024996

@@ -1038,31 +1010,6 @@ PEPs
10381010
.. [#pep613] PEP 613 -- Explicit Type Aliases, Zhu (https://www.python.org/dev/peps/pep-0613)
10391011
.. [#pep3107] PEP 3107 -- Function Annotations, Winter and Lownds (https://www.python.org/dev/peps/pep-3107)
10401012
1041-
Type Checkers
1042-
-------------
1043-
1044-
.. [#mypy] mypy -- Optional Static Typing for Python (http://www.mypy-lang.org/)
1045-
.. [#pyre] Pyre -- A performant type-checker for Python 3 (https://pyre-check.org/)
1046-
.. [#pyright] pyright -- Static type checker for Python (https://github.com/microsoft/pyright)
1047-
.. [#pytype] pytype -- A static analyzer for Python code (https://github.com/google/pytype)
1048-
1049-
IDEs with Typing Support
1050-
------------------------
1051-
1052-
.. [#pycharm] PyCharm -- The Python IDE for Professional Developers (https://www.jetbrains.com/pycharm/)
1053-
.. [#pylance] Pylance -- Fast, feature-rich language support for Python (https://github.com/microsoft/pylance-release)
1054-
.. [#vscode] Visual Studio Code -- Code Editing. Redefined (https://code.visualstudio.com/)
1055-
1056-
Other Resources
1057-
---------------
1058-
1059-
.. [#black] black -- The uncompromising code formatter (https://black.readthedocs.io/)
1060-
.. [#flake8] Flake8 -- Your Tool For Style Guide Enforcement (http://flake8.pycqa.org/)
1061-
.. [#flake8-pyi] flake8-pyi -- A plugin for Flake8 that provides specializations for type hinting stub files (https://github.com/ambv/flake8-pyi)
1062-
.. [#typeshed] typeshed -- Collection of library stubs for Python, with static types (https://github.com/python/typeshed)
1063-
.. [#ast] ast -- Abstract Syntax Trees, Python standard library module (https://docs.python.org/3/library/ast.html)
1064-
.. [#typed_ast] typed_ast -- Fork of CPython's ast module (https://pypi.org/project/typed-ast/)
1065-
10661013
Copyright
10671014
=========
10681015

0 commit comments

Comments
 (0)