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...
Supported Python features Runtime definition of methods and functions Supported Python features A list of unsupported Python features is maintained in the mypy wiki: Unsuppo...
When you’re puzzled or when things are complicated When you’re puzzled or when things are complicated from typing import Union , Any , List , Optional , cast # T...
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...
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...
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...
Gotchas and limitations of metaclass support Gotchas and limitations of metaclass support Note that metaclasses pose some requirements on the inheritance structure,so it’s bett...
Disabling strict optional checking Disabling strict optional checking Mypy also has an option to treat None as a valid value for everytype (in case you know Java, it’s useful ...
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...