Skip to content

Commit 14d9ab4

Browse files
committed
mention typeshed in basics.rst
1 parent b5e5006 commit 14d9ab4

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

docs/source/basics.rst

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ explains how to download and install mypy.
124124

125125
.. _library-stubs:
126126

127-
Library stubs
128-
*************
127+
Typeshed
128+
********
129129

130130
In order to type check code that uses library modules such as those
131131
included in the Python standard library, you need to have library
@@ -141,8 +141,9 @@ For example, consider this code:
141141
142142
Without a library stub, the type checker has no way of inferring the
143143
type of ``x`` and checking that the argument to ``chr`` has a valid
144-
type. Mypy comes with a library stub for Python builtins that contains
145-
a definition like this for ``chr``:
144+
type. Mypy contains the `typeshed http://github.com/python/typeshed`_ project,
145+
which contains library stubs for Python builtins that contains a definition
146+
like this for ``chr``:
146147

147148
.. code-block:: python
148149
@@ -167,9 +168,13 @@ for module ``csv``, and use a subdirectory with ``__init__.pyi`` for packages.
167168
If there is both a ``.py`` and a ``.pyi`` file for a module, the ``.pyi`` file
168169
takes precedence. This way you can easily add annotations for a module even if
169170
you don't want to modify the source code. This can be useful, for example, if you
170-
use 3rd party open source libraries in your program. You can also override the stubs
171-
mypy uses for standard libary modules, in case you need to make local
172-
modifications.
171+
use 3rd party open source libraries in your program.
172+
173+
You can also override the stubs mypy uses for standard libary modules, in case
174+
you need to make local modifications. (Note that if you want to submit your
175+
changes, please submit a pull request to `typeshed http://github.com/python/typeshed`_
176+
first, and then update the submodule in mypy using a commit that only touches
177+
the typeshed submodule and nothing else)
173178

174179
That's it! Now you can access the module in mypy programs and type check
175180
code that uses the library. If you write a stub for a library module,

0 commit comments

Comments
 (0)