See Config file in the MyPy docs.

From help:

  --config-file CONFIG_FILE
                            Configuration file, must have a [mypy] section (defaults to mypy.ini,
                            .mypy.ini, setup.cfg, ~/.config/mypy/config, ~/.mypy.ini)

Project config

Add in the repo:

  • mypy.ini
  • .mypy.ini
  • setup.cfg

Use config

  • ~/.config/mypy/config
  • ~/.mypy.ini


Note you will get a warning if you leave out the global [mypy] section.

  • sample.ini
    python_version = 3.8
    warn_return_any = True
    warn_unused_configs = True
    disallow_untyped_defs = True
    warn_return_any = False
    ignore_missing_imports = True