@@ -72,6 +72,24 @@ Import discovery
7272The following flags customize how exactly mypy discovers and follows
7373imports.
7474
75+ ``--namespace-packages ``
76+ This flag enables import discovery to use namespace packages (see
77+ `PEP 420 `_). In particular, this allows discovery of imported
78+ packages that don't have an ``__init__.py `` (or ``__init__.pyi ``)
79+ file.
80+
81+ Namespace packages are found (using the PEP 420 rules, which
82+ prefers "classic" packages over namespace packages) along the
83+ module search path -- this is primarily set from the source files
84+ passed on the command line, the ``MYPYPATH `` environment variable,
85+ and the :ref: `mypy_path config option
86+ <config-file-import-discovery-global>`.
87+
88+ Note that this only affects import discovery -- for modules and
89+ packages explicitly passed on the command line, mypy still
90+ searches for ``__init__.py[i] `` files in order to determine the
91+ fully-qualified module/package name.
92+
7593``--ignore-missing-imports ``
7694 This flag makes mypy ignore all missing imports. It is equivalent
7795 to adding ``# type: ignore `` comments to all unresolved imports
@@ -570,6 +588,8 @@ Miscellaneous
570588 have many scripts that import a large package, the behavior enabled
571589 by this flag is often more convenient.)
572590
591+ .. _PEP 420 : https://www.python.org/dev/peps/pep-0420/
592+
573593.. _PEP 561 : https://www.python.org/dev/peps/pep-0561/
574594
575595.. _lxml : https://pypi.org/project/lxml/
0 commit comments