Skip to content
Latchkey

mypy --follow-imports: Control Import Following

mypy --follow-imports decides whether mypy analyzes, silently checks, skips, or errors on imported modules not named on the command line.

Import following governs how far mypy reaches beyond the files you pass. The mode you pick trades coverage for speed and noise.

What it does

mypy --follow-imports controls handling of modules reached through imports that were not explicitly passed. normal (default) analyzes and reports them; silent analyzes but suppresses their errors; skip does not analyze and treats them as Any; error reports any followed import as an error.

Common usage

Terminal
mypy --follow-imports=normal src/
mypy --follow-imports=silent src/   # check but do not report followed modules
mypy --follow-imports=skip src/     # treat followed imports as Any

Options

ValueWhat it does
normalFollow and report errors in imported modules (default)
silentFollow and check but do not report their errors
skipDo not follow; treat the module as Any
errorTreat any followed import as an error

In CI

Leave it at normal for full coverage in a CI gate; reach for silent only during a migration when you want imported legacy modules checked but not reported. follow_imports = "skip" speeds runs but hides real errors, so reserve it for genuinely external code paired with ignore_missing_imports.

Common errors in CI

Setting follow_imports=skip can make mypy "pass" while missing bugs in imported modules, because they are treated as Any. Conversely follow_imports=error surfaces "Import of X is unfollowed" style failures; switch to silent or skip for those specific modules via a per-module override.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →