Skip to content

Commit cd18f07

Browse files
JukkaLilevkivskyi
authored andcommitted
Update stubgen docs (#8031)
Add missing options to stubgen docs and mention new heuristics it uses to skip test and vendored modules.
1 parent 37a2b9a commit cd18f07

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

docs/source/stubgen.rst

+21-3
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ Details of the options:
104104
You can't mix paths and :option:`-m`/:option:`-p` options in the same stubgen
105105
invocation.
106106

107+
Stubgen applies heuristics to avoid generating stubs for submodules
108+
that include tests or vendored third-party packages.
109+
107110
Specifying how to generate stubs
108111
********************************
109112

@@ -116,12 +119,13 @@ alter the default behavior:
116119

117120
.. option:: --no-import
118121

119-
Don't try to import modules. Instead use mypy's normal search mechanism to find
122+
Don't try to import modules. Instead only use mypy's normal search mechanism to find
120123
sources. This does not support C extension modules. This flag also disables
121124
runtime introspection functionality, which mypy uses to find the value of
122125
``__all__``. As result the set of exported imported names in stubs may be
123-
incomplete. This flag is generally only useful when importing a module generates
124-
an error for some reason.
126+
incomplete. This flag is generally only useful when importing a module causes
127+
unwanted side effects, such as the running of tests. Stubgen tries to skip test
128+
modules even without this option, but this does not always work.
125129

126130
.. option:: --parse-only
127131

@@ -153,6 +157,12 @@ Additional flags
153157
Include definitions that are considered private in stubs (with names such
154158
as ``_foo`` with single leading underscore and no trailing underscores).
155159

160+
.. option:: --export-less
161+
162+
Don't export all names imported from other modules within the same package.
163+
Instead, only export imported names that are not referenced in the module
164+
that contains the import.
165+
156166
.. option:: --search-path PATH
157167

158168
Specify module search directories, separated by colons (only used if
@@ -171,3 +181,11 @@ Additional flags
171181
``./out`` directory. The output directory will be created if it doesn't
172182
exist. Existing stubs in the output directory will be overwritten without
173183
warning.
184+
185+
.. option:: -v, --verbose
186+
187+
Produce more verbose output.
188+
189+
.. option:: -q, --quiet
190+
191+
Produce less verbose output.

0 commit comments

Comments
 (0)