Check the return type of exit [exit-return] Check the return type of exit [exit-return] If mypy can determine that exit always returns False , mypychecks that the return t...
Miscellaneous Miscellaneous —junit-xml JUNIT_XML Causes mypy to generate a JUnit XML test result document withtype checking results. This can make it easier to integrate my...
Displaying the type of an expression Displaying the type of an expression You can use reveal_type(expr) to ask mypy to display the inferredstatic type of an expression. This c...
Basic usage Basic usage The client utility dmypy is used to control the mypy daemon.Use dmypy run — <flags> <files> to typecheck a set of files(or directories). This will lau...
How imports are found How imports are found When mypy encounters an import statement or receives modulenames from the command line via the —module or —package flags, mypy t...
Dataclasses Caveats/Known Issues Dataclasses In Python 3.7, a new dataclasses module has been added to the standard library.This module allows defining and customizing simpl...
Automatic stub generation (stubgen) Automatic stub generation (stubgen) A stub file (see PEP 484 ) contains only type hints for the publicinterface of a module, with empty fun...
Limitations Limitations Mypy will not understand expressions that use variables of type Literal[..] on a deep level. For example, if you have a variable a of type Literal[3] a...
None and Optional handling None and Optional handling For more information, see the None and Optional handling section of the command line docs. no_implicit_optional (bool, ...
Duck type compatibility Duck type compatibility In Python, certain types are compatible even though they aren’t subclasses ofeach other. For example, int objects are valid whe...