Your company here — click to reach over 10,000 unique daily visitors

stubgen - Man Page

manual page for mypy stubgen 1.10.1-dev


usage: stubgen [-h] [more options, see -h]

[-m MODULE] [-p PACKAGE] [files ...]

Generate draft stubs for modules. Stubs are generated in directory ./out, to avoid overriding files with manual changes. This directory is assumed to exist.

positional arguments


generate stubs for given files or directories


-h,  --help

show this help message and exit


ignore errors when trying to generate stubs for modules


don't import the modules, just parse and analyze them (doesn't work with C extension modules and might not respect __all__)

--no-analysis,  --parse-only

don't perform semantic analysis of sources, just parse them (only applies to Python modules, might affect quality of stubs. Not compatible with --inspect)


import and inspect modules instead of parsing source code.This is the default behavior for c modules and pyc-only packages, but it is also useful for pure python modules with dynamically generated members.


generate stubs for objects and members considered private (single leading underscore and no trailing underscores)


don't implicitly export all names imported from other modules in the same package


include existing docstrings with the stubs

-v,  --verbose

show more verbose messages

-q,  --quiet

show fewer messages

--doc-dir PATH

use .rst documentation in PATH (this may result in better stubs in some cases; consider setting this to DIR/Python-X.Y.Z/Doc/library)

--search-path PATH

specify module search directories, separated by ':' (currently only used if --no-import is given)

-o,  --output PATH

change the output directory [default: out]

-m,  --module MODULE

generate stub for module; can repeat for more modules

-p,  --package PACKAGE

generate stubs for package recursively; can be repeated


June 2024 mypy stubgen 1.10.1-dev