From 84d379342495fd1b61f19ab66814f094ebae448c Mon Sep 17 00:00:00 2001 From: nightcityblade Date: Mon, 10 Aug 2026 11:23:07 +0800 Subject: [PATCH] Document follow_imports_for_stubs usage --- docs/source/config_file.rst | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/source/config_file.rst b/docs/source/config_file.rst index d5431b1476aa0..9c04adffa94c5 100644 --- a/docs/source/config_file.rst +++ b/docs/source/config_file.rst @@ -382,6 +382,18 @@ section of the command line docs. to suppress the import of a module from ``typeshed``, replacing it with ``Any``. + For example, suppose your code monkey-patches ``email.message`` with extra + members that are not declared in its ``typeshed`` stub. You can treat + imports from that module as ``Any`` with a per-module section: + + .. code-block:: ini + + [mypy] + + [mypy-email.message] + follow_imports = skip + follow_imports_for_stubs = True + Used in conjunction with :confval:`follow_imports=error `, this can be used to make any use of a particular ``typeshed`` module an error.