File: typeshed.rst

package info (click to toggle)
python-schema-salad 8.9.20250723145140-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,076 kB
  • sloc: python: 19,177; cpp: 2,631; cs: 1,869; java: 1,341; makefile: 187; xml: 184; sh: 103; javascript: 46
file content (22 lines) | stat: -rw-r--r-- 656 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
How to add new types to the local Typeshed
------------------------------------------


If when running ``make mypy`` you receive errors about modules that can't be
found you may need to add type stubs for new modules to the ``mypy-stubs/``
directory.

::

 stubgen -o mypy-stubs module_name
 make mypy

Note: the module name is not always the name of the PyPI package
(``CacheControl`` vs ``cachecontrol``).

Stubs are just that, you will still need to annotate whichever functions you
call.

Oftentimes it is simpler to comment out imports in the ``.pyi`` stubs that are
not needed yet. The goal is represent the public API, or at least the part we
use.