1MYPY(1)                          User Commands                         MYPY(1)
2
3
4

NAME

6       mypy - manual page for mypy 0.761-dev
7

DESCRIPTION

9       usage: mypy [-h] [-v] [-V] [more options; see below]
10
11              [-m MODULE] [-p PACKAGE] [-c PROGRAM_TEXT] [files ...]
12
13       Mypy is a program that will type check your Python code.
14
15       Pass  in  any files or folders you want to type check. Mypy will recur‐
16       sively traverse any provided folders to find .py files:
17
18              $ mypy my_program.py my_src_folder
19
20       For more information on getting started, see:
21
22       - http://mypy.readthedocs.io/en/latest/getting_started.html
23
24       For more details on both running mypy and using the flags below, see:
25
26       -       http://mypy.readthedocs.io/en/latest/running_mypy.html        -
27       http://mypy.readthedocs.io/en/latest/command_line.html
28
29       You  can also use a config file to configure mypy instead of using com‐
30       mand line flags. For more details, see:
31
32       - http://mypy.readthedocs.io/en/latest/config_file.html
33
34   Optional arguments:
35       -h, --help
36              Show this help message and exit
37
38       -v, --verbose
39              More verbose messages
40
41       -V, --version
42              Show program's version number and exit
43
44   Config file:
45              Use a config file instead of command  line  arguments.  This  is
46              useful  if  you  are  using  many flags or want to set different
47              options per each module.
48
49       --config-file CONFIG_FILE
50              Configuration file, must have  a  [mypy]  section  (defaults  to
51              mypy.ini, setup.cfg, ~/.config/mypy/config, ~/.mypy.ini)
52
53       --warn-unused-configs
54              Warn  about  unused '[mypy-<pattern>]' config sections (inverse:
55              --no-warn-unused-configs)
56
57   Import discovery:
58              Configure how imports are discovered and followed.
59
60       --namespace-packages
61              Support namespace packages (PEP 420, __init__.pyless)  (inverse:
62              --no-namespace-packages)
63
64       --ignore-missing-imports
65              Silently ignore imports of missing modules
66
67       --follow-imports {normal,silent,skip,error}
68              How to treat imports (default normal)
69
70       --python-executable EXECUTABLE
71              Python  executable  used for finding PEP 561 compliant installed
72              packages and stubs
73
74       --no-site-packages
75              Do not search for installed PEP 561 compliant packages
76
77       --no-silence-site-packages
78              Do not silence errors in PEP 561 compliant installed packages
79
80   Platform configuration:
81              Type check code assuming it will be run  under  certain  runtime
82              conditions.   By  default,  mypy  assumes  your code will be run
83              using the same operating system and Python version you are using
84              to run mypy itself.
85
86       --python-version x.y
87              Type check code assuming it will be running on Python x.y
88
89       -2, --py2
90              Use Python 2 mode (same as --python-version 2.7)
91
92       --platform PLATFORM
93              Type   check  special-cased  code  for  the  given  OS  platform
94              (defaults to sys.platform)
95
96       --always-true NAME
97              Additional variable to be considered True (may be repeated)
98
99       --always-false NAME
100              Additional variable to be considered False (may be repeated)
101
102   Disallow dynamic typing:
103              Disallow the use of the dynamic 'Any' type under certain  condi‐
104              tions.
105
106       --disallow-any-unimported
107              Disallow Any types resulting from unfollowed imports
108
109       --disallow-any-expr
110              Disallow all expressions that have type Any
111
112       --disallow-any-decorated
113              Disallow  functions that have Any in their signature after deco‐
114              rator transformation
115
116       --disallow-any-explicit
117              Disallow explicit Any in type positions
118
119       --disallow-any-generics
120              Disallow usage of generic types that  do  not  specify  explicit
121              type parameters (inverse: --allow-any-generics)
122
123       --disallow-subclassing-any
124              Disallow  subclassing values of type 'Any' when defining classes
125              (inverse: --allow-subclassingany)
126
127   Untyped definitions and calls:
128              Configure how untyped definitions and calls are  handled.  Note:
129              by  default,  mypy  ignores any untyped function definitions and
130              assumes any calls to such functions have a return type of 'Any'.
131
132       --disallow-untyped-calls
133              Disallow calling functions without type annotations  from  func‐
134              tions with type annotations (inverse: --allow-untyped-calls)
135
136       --disallow-untyped-defs
137              Disallow  defining  functions  without  type annotations or with
138              incomplete type annotations (inverse: --allow-untyped-defs)
139
140       --disallow-incomplete-defs
141              Disallow defining functions  with  incomplete  type  annotations
142              (inverse: --allow-incomplete-defs)
143
144       --check-untyped-defs
145              Type  check  the  interior of functions without type annotations
146              (inverse: --no-check-untyped-defs)
147
148       --disallow-untyped-decorators
149              Disallow decorating  typed  functions  with  untyped  decorators
150              (inverse: --allow-untyped-decorators)
151
152   None and Optional handling:
153              Adjust  how  values of type 'None' are handled. For more context
154              on   how   mypy   handles   values   of   type   'None',    see:
155              http://mypy.readthedocs.io/en/lat
156              est/kinds_of_types.html#no-strictoptional
157
158       --no-implicit-optional
159              Don't assume arguments with default values of None are  Optional
160              (inverse: --implicit-optional)
161
162       --no-strict-optional
163              Disable strict Optional checks (inverse: --strictoptional)
164
165   Configuring warnings:
166              Detect code that is sound but redundant or problematic.
167
168       --warn-redundant-casts
169              Warn  about casting an expression to its inferred type (inverse:
170              --no-warn-redundant-casts)
171
172       --warn-unused-ignores
173              Warn  about  unneeded  '#  type:  ignore'   comments   (inverse:
174              --no-warn-unused-ignores)
175
176       --no-warn-no-return
177              Do not warn about functions that end without returning (inverse:
178              --warn-no-return)
179
180       --warn-return-any
181              Warn about returning values of type Any from nonAny typed  func‐
182              tions (inverse: --no-warn-returnany)
183
184       --warn-unreachable
185              Warn  about statements or expressions inferred to be unreachable
186              or redundant (inverse: --no-warnunreachable)
187
188   Miscellaneous strictness flags:
189       --allow-untyped-globals
190              Suppress toplevel errors caused by missing annotations (inverse:
191              --disallow-untyped-globals)
192
193       --allow-redefinition
194              Allow  unconditional  variable  redefinition  with  a  new  type
195              (inverse: --disallow-redefinition)
196
197       --no-implicit-reexport
198              Treat   imports   as   private    unless    aliased    (inverse:
199              --implicit-reexport)
200
201       --strict-equality
202              Prohibit  equality, identity, and container checks for non-over‐
203              lapping types (inverse: --no-strictequality)
204
205       --strict
206              Strict mode; enables the following flags:  --warnunused-configs,
207              --disallow-any-generics,   --disallow-subclassing-any,  --disal‐
208              low-untypedcalls,   --disallow-untyped-defs,    --disallowincom‐
209              plete-defs,  --check-untyped-defs, --disallowuntyped-decorators,
210              --no-implicit-optional,                  --warn-redundant-casts,
211              --warn-unused-ignores, --warn-return-any, --no-implicit-reexport
212
213   Configuring error messages:
214              Adjust the amount of detail shown in error messages.
215
216       --show-error-context
217              Precede   errors   with   "note:"  messages  explaining  context
218              (inverse: --hide-error-context)
219
220       --show-column-numbers
221              Show column numbers  in  error  messages  (inverse:  --hide-col‐
222              umn-numbers)
223
224       --show-error-codes
225              Show error codes in error messages (inverse: --hide-error-codes)
226
227       --pretty
228              Use visually nicer output in error messages: Use soft word wrap,
229              show source code  snippets,  and  show  error  location  markers
230              (inverse: --no-pretty)
231
232       --no-color-output
233              Do not colorize error messages (inverse: --coloroutput)
234
235       --no-error-summary
236              Do not show error stats summary (inverse: --errorsummary)
237
238       --show-absolute-path
239              Show absolute paths to files (inverse: --hideabsolute-path)
240
241   Incremental mode:
242              Adjust  how  mypy  incrementally type checks and caches modules.
243              Mypy caches type information about modules into a cache  to  let
244              you  speed up future invocations of mypy. Also see mypy's daemon
245              mode: mypy.readthedocs.io/en/latest/mypy_daemon.html#mypy-daemon
246
247       --no-incremental
248              Disable module cache (inverse: --incremental)
249
250       --cache-dir DIR
251              Store module cache info in the given folder in incremental  mode
252              (defaults to '.mypy_cache')
253
254       --sqlite-cache
255              Use   a   sqlite   database   to   store   the  cache  (inverse:
256              --no-sqlite-cache)
257
258       --cache-fine-grained
259              Include fine-grained dependency information in the cache for the
260              mypy daemon
261
262       --skip-version-check
263              Allow using cache written by older mypy version
264
265       --skip-cache-mtime-checks
266              Skip cache internal consistency checks based on mtime
267
268   Advanced options:
269              Debug and customize mypy internals.
270
271       --pdb  Invoke pdb on fatal error
272
273       --show-traceback, --tb
274              Show traceback on fatal error
275
276       --raise-exceptions
277              Raise exception on fatal error
278
279       --custom-typing-module MODULE
280              Use a custom typing module
281
282       --custom-typeshed-dir DIR
283              Use the custom typeshed in DIR
284
285       --warn-incomplete-stub
286              Warn  if missing type annotation in typeshed, only relevant with
287              --disallow-untyped-defs  or  --disallow-incomplete-defs  enabled
288              (inverse: --nowarn-incomplete-stub)
289
290       --shadow-file SOURCE_FILE SHADOW_FILE
291              When  encountering SOURCE_FILE, read and type check the contents
292              of SHADOW_FILE instead.
293
294   Report generation:
295              Generate a report in the specified format.
296
297       --any-exprs-report DIR
298
299       --cobertura-xml-report DIR
300
301       --html-report DIR
302
303       --linecount-report DIR
304
305       --linecoverage-report DIR
306
307       --lineprecision-report DIR
308
309       --txt-report DIR
310
311       --xml-report DIR
312
313       --xslt-html-report DIR
314
315       --xslt-txt-report DIR
316
317   Miscellaneous:
318       --junit-xml JUNIT_XML
319              Write junit.xml to the given file
320
321       --find-occurrences CLASS.MEMBER
322              Print out all usages of a class member (experimental)
323
324       --scripts-are-modules
325              Script x becomes module x instead of __main__
326
327   Running code:
328              Specify the code you want to type check. For more  details,  see
329              mypy.readthedocs.io/en/latest/running_mypy.html#running-mypy
330
331       -m MODULE, --module MODULE
332              Type-check module; can repeat for more modules
333
334       -p PACKAGE, --package PACKAGE
335              Type-check package recursively; can be repeated
336
337       -c PROGRAM_TEXT, --command PROGRAM_TEXT
338              Type-check program passed in as string
339
340       files  Type-check given files or directories
341
342   Environment variables:
343              Define  MYPYPATH  for  additional  module  search  path entries.
344              Define MYPY_CACHE_DIR to override configuration cache_dir path.
345
346
347
348mypy 0.761-dev                   January 2020                          MYPY(1)
Impressum