LinuxCommandLibrary

mypy

Type check Python code.

TLDR

Type check a specific file

$ mypy [path/to/file.py]
copy


Type check a specific [m]odule
$ mypy -m [module_name]
copy


Type check a specific [p]ackage
$ mypy -p [package_name]
copy


Type check a string of code
$ mypy -c "[code]"
copy


Ignore missing imports
$ mypy --ignore-missing-imports [path/to/file_or_directory]
copy


Show detailed error messages
$ mypy --show-traceback [path/to/file_or_directory]
copy


Specify a custom configuration file
$ mypy --config-file [path/to/config_file]
copy


Display [h]elp
$ mypy -h
copy

Copied to clipboard