@@ -503,7 +503,7 @@ accepts one of four string values:
503503 main.py:1: note: (Using --follow-imports=error, module not passed on command line)
504504
505505If you are starting a new codebase and plan on using type hints from
506- the start, we recommend you use either :option: `--follow-imports=normal <mypy --follow-imports> `
506+ the start, we ** recommend ** you use either :option: `--follow-imports=normal <mypy --follow-imports> `
507507(the default) or :option: `--follow-imports=error <mypy --follow-imports> `. Either option will help
508508make sure you are not skipping checking any part of your codebase by
509509accident.
@@ -514,16 +514,27 @@ files that do not use type hints) pass under :option:`--follow-imports=normal <m
514514This is usually not too difficult to do: mypy is designed to report as
515515few error messages as possible when it is looking at unannotated code.
516516
517- Only if doing this is intractable, we recommend passing mypy just the files
518- you want to type check and use :option: `--follow-imports=silent <mypy --follow-imports> `. Even if
519- mypy is unable to perfectly type check a file, it can still glean some
517+ Only if doing this is intractable, try passing mypy just the files
518+ you want to type check and using :option: `--follow-imports=silent <mypy --follow-imports> `.
519+ Even if mypy is unable to perfectly type check a file, it can still glean some
520520useful information by parsing it (for example, understanding what methods
521521a given object has). See :ref: `existing-code ` for more recommendations.
522522
523- We do not recommend using ``skip `` unless you know what you are doing:
524- while this option can be quite powerful, it can also cause many
525- hard-to-debug errors.
526-
527523Adjusting import following behaviour is often most useful when restricted to
528524specific modules. This can be accomplished by setting a per-module
529525:confval: `follow_imports ` config option.
526+
527+ .. warning ::
528+
529+ We do not recommend using ``follow_imports=skip `` unless you're really sure
530+ you know what you are doing. This option greatly restricts the analysis mypy
531+ can perform and you will lose a lot of the benefits of type checking.
532+
533+ This is especially true at the global level. Setting a per-module
534+ ``follow_imports=skip `` for a specific problematic module can be
535+ useful without causing too much harm.
536+
537+ .. note ::
538+
539+ If you're looking to resolve import errors related to libraries, try following
540+ the advice in :ref: `fix-missing-imports ` before messing with ``follow_imports ``.
0 commit comments