| 1 |
==== |
| 2 |
mypy |
| 3 |
==== |
| 4 |
|
| 5 |
SYNOPSIS |
| 6 |
======== |
| 7 |
|
| 8 |
**mypy** [-h] [-v] [-V] [-m `MODULE`] [-p `PACKAGE`] [-c `PROGRAM_TEXT`] [`OPTIONS`...] [`FILES` ...] |
| 9 |
|
| 10 |
DESCRIPTION |
| 11 |
=========== |
| 12 |
|
| 13 |
Mypy is a static type checker for Python 3 and Python 2.7. If you sprinkle |
| 14 |
your code with type annotations, mypy can type check your code and find |
| 15 |
common bugs. As mypy is a static analyzer, or a lint-like tool, the type |
| 16 |
annotations are just hints for mypy and don’t interfere when running |
| 17 |
your program. You run your program with a standard Python interpreter, |
| 18 |
and the annotations are treated effectively as comments. |
| 19 |
|
| 20 |
Using the Python 3 function annotation syntax (using the PEP 484 notation) |
| 21 |
or a comment-based annotation syntax for Python 2 code, you will be |
| 22 |
able to efficiently annotate your code and use mypy to check the code |
| 23 |
for common errors. Mypy has a powerful and easy-to-use type system with |
| 24 |
modern features such as type inference, generics, callable types, tuple |
| 25 |
types, union types, and structural subtyping. |
| 26 |
|
| 27 |
Mypy is invoked with the paths the user needs to check:: |
| 28 |
|
| 29 |
$ mypy foo.py bar.py some_directory |
| 30 |
|
| 31 |
The directories are checked recursively to find Python source files. |
| 32 |
|
| 33 |
.. role:: ref |
| 34 |
.. include:: mypy_options.rst |
| 35 |
|
| 36 |
ENVIRONMENT |
| 37 |
=========== |
| 38 |
|
| 39 |
**MYPYPATH** |
| 40 |
Additional module search path entries. The format is the same as the shell's `$PATH`: one or more directory pathnames separated by colons. |
| 41 |
|
| 42 |
SEE ALSO |
| 43 |
======== |
| 44 |
|
| 45 |
**dmypy**\(1) |
| 46 |
|
| 47 |
Full documentation is available online at: http://mypy.readthedocs.io/en/latest/getting_started.html |
| 48 |
or locally at: `/usr/share/doc/mypy/html <file:///usr/share/doc/mypy/html>`__ (requires `mypy-doc` package). |