| 1 |
======= |
| 2 |
stubgen |
| 3 |
======= |
| 4 |
|
| 5 |
SYNOPSIS |
| 6 |
======== |
| 7 |
|
| 8 |
**stubgen** [-h] [-py2] [-m `MODULE`] [-p `PACKAGE`] [`OPTIONS`...] [`FILES`...] |
| 9 |
|
| 10 |
DESCRIPTION |
| 11 |
=========== |
| 12 |
|
| 13 |
Mypy is a static type checker for Python 3 and Python 2.7. Mypy includes |
| 14 |
the `stubgen` tool that can automatically generate stub files (`.pyi` |
| 15 |
files) for Python modules and C extension modules. |
| 16 |
|
| 17 |
A stub file (see PEP 484) contains only type hints for the public |
| 18 |
interface of a module, with empty function bodies. Mypy can use a stub |
| 19 |
file instead of the real implementation to provide type information for |
| 20 |
the module. They are useful for third-party modules whose authors have |
| 21 |
not yet added type hints (and when no stubs are available in typeshed) |
| 22 |
and C extension modules (which mypy can’t directly process). |
| 23 |
|
| 24 |
Stubgen generates *draft* stubs. The auto-generated stub files often require some manual updates, and most types will default to `Any`. The stubs will be much more useful if you add more precise type annotations, at least for the most commonly used functionality. |
| 25 |
|
| 26 |
OPTIONS |
| 27 |
======= |
| 28 |
|
| 29 |
.. role:: ref |
| 30 |
.. include:: stubgen_options.rst |
| 31 |
|
| 32 |
ENVIRONMENT |
| 33 |
=========== |
| 34 |
|
| 35 |
**MYPYPATH** |
| 36 |
Additional module search path entries. The format is the same as the shell's `$PATH`: one or more directory pathnames separated by colons. |
| 37 |
|
| 38 |
SEE ALSO |
| 39 |
======== |
| 40 |
|
| 41 |
**mypy**\(1) |
| 42 |
|
| 43 |
Full documentation is available online at: https://mypy.readthedocs.io/en/latest/stubgen.html |
| 44 |
or locally at: `/usr/share/doc/mypy/html <file:///usr/share/doc/mypy/html>`__ (requires `mypy-doc` package). |