Specifying how to generate stubs
By default stubgen will try to import the target modules and packages.This allows stubgen to use runtime introspection to generate stubs for Cextension modules and to improve the quality of the generatedstubs. By default, stubgen will also use mypy to perform light-weightsemantic analysis of any Python modules. Use the following flags toalter the default behavior:
—no-import
- Don’t try to import modules. Instead only use mypy’s normal search mechanism to findsources. This does not support C extension modules. This flag also disablesruntime introspection functionality, which mypy uses to find the value of
all
. As result the set of exported imported names in stubs may beincomplete. This flag is generally only useful when importing a module causesunwanted side effects, such as the running of tests. Stubgen tries to skip testmodules even without this option, but this does not always work.