@@ -72,6 +72,24 @@ Import discovery
72
72
The following flags customize how exactly mypy discovers and follows
73
73
imports.
74
74
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
+
75
93
``--ignore-missing-imports ``
76
94
This flag makes mypy ignore all missing imports. It is equivalent
77
95
to adding ``# type: ignore `` comments to all unresolved imports
@@ -570,6 +588,8 @@ Miscellaneous
570
588
have many scripts that import a large package, the behavior enabled
571
589
by this flag is often more convenient.)
572
590
591
+ .. _PEP 420 : https://www.python.org/dev/peps/pep-0420/
592
+
573
593
.. _PEP 561 : https://www.python.org/dev/peps/pep-0561/
574
594
575
595
.. _lxml : https://pypi.org/project/lxml/
0 commit comments