Specifying what to type check

By default, you can specify what code you want mypy to type checkby passing in the paths to what you want to have type checked:

  1. $ mypy foo.py bar.py some_directory

Note that directories are checked recursively.

Mypy also lets you specify what code to type check in several otherways. A short summary of the relevant flags is included below:for full details, see Running mypy and managing imports.

  • -m MODULE, —module MODULE
  • Asks mypy to type check the provided module. This flag may berepeated multiple times.

Mypy will not recursively type check any submodules of the providedmodule.

  • -p PACKAGE, —package PACKAGE
  • Asks mypy to type check the provided package. This flag may berepeated multiple times.

Mypy will recursively type check any submodules of the providedpackage. This flag is identical to —module apart from thisbehavior.

  • -c PROGRAM_TEXT, —command PROGRAM_TEXT
  • Asks mypy to type check the provided string as a program.