Skip to content

Commit ab9f395

Browse files
authored
Merge pull request #50 from common-workflow-language/type-docs
document how to expand Typeshed
2 parents c646a62 + 4ef0ed1 commit ab9f395

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

docs/typeshed.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
How to add new types to the local Typeshed
2+
------------------------------------------
3+
4+
5+
If when running ``make mypy`` you receive errors about modules that can't be
6+
found you may need to add type stubs for new modules to the ``typeshed/``
7+
directory.
8+
9+
::
10+
11+
mkdir out
12+
stubgen --py2 module_name
13+
mv out/module_name/* typeshed/2.7/
14+
make mypy
15+
16+
Note: the module name is not always the name of the PyPI package
17+
(``CacheControl`` vs ``cachecontrol``).
18+
19+
Stubs are just that, you will still need to annotate whichever functions you
20+
call.
21+
22+
Oftentimes it is simpler to comment out imports in the ``.pyi`` stubs that are
23+
not needed yet. The goal is represent the public API, or at least the part we
24+
use.

0 commit comments

Comments
 (0)