Skip to content

Update stubgen docs #8031

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 28, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions docs/source/stubgen.rst
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ Details of the options:
You can't mix paths and :option:`-m`/:option:`-p` options in the same stubgen
invocation.

Stubgen applies heuristics to avoid generating stubs for submodules
that include tests or vendored third-party packages.

Specifying how to generate stubs
********************************

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

.. option:: --no-import

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

.. option:: --parse-only

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

.. option:: --export-less

Don't export all names imported from other modules within the same package.
Instead, only export imported names that are not referenced in the module
that contains the import.

.. option:: --search-path PATH

Specify module search directories, separated by colons (only used if
Expand All @@ -171,3 +181,11 @@ Additional flags
``./out`` directory. The output directory will be created if it doesn't
exist. Existing stubs in the output directory will be overwritten without
warning.

.. option:: -v, --verbose

Produce more verbose output.

.. option:: -q, --quiet

Produce less verbose output.