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

NAME

6       mypy - manual page for mypy 0.670-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       --ignore-missing-imports
61              Silently ignore imports of missing modules
62
63       --follow-imports {normal,silent,skip,error}
64              How to treat imports (default normal)
65
66       --python-executable EXECUTABLE
67              Python executable used for finding PEP 561  compliant  installed
68              packages and stubs
69
70       --no-site-packages
71              Do not search for installed PEP 561 compliant packages
72
73       --no-silence-site-packages
74              Do not silence errors in PEP 561 compliant installed packages
75
76       --namespace-packages
77              Support  namespace packages (PEP 420, __init__.pyless) (inverse:
78              --no-namespace-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   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-subclassing-any
110              Disallow  subclassing values of type 'Any' when defining classes
111              (inverse: --allow-subclassingany)
112
113       --disallow-any-expr
114              Disallow all expressions that have type Any
115
116       --disallow-any-decorated
117              Disallow functions that have Any in their signature after  deco‐
118              rator transformation
119
120       --disallow-any-explicit
121              Disallow explicit Any in type positions
122
123       --disallow-any-generics
124              Disallow  usage  of  generic  types that do not specify explicit
125              type parameters (inverse: --allow-any-generics)
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:  mypy.readthe‐
155              docs.io/en/latest/kinds_of_types.html#no-strict-optional
156
157       --no-implicit-optional
158              Don't  assume arguments with default values of None are Optional
159              (inverse: --implicit-optional)
160
161       --no-strict-optional
162              Disable strict Optional checks (inverse: --strictoptional)
163
164       --strict-optional-whitelist [GLOB [GLOB ...]]
165              Suppress strict Optional errors in all but the  provided  files;
166              implies  --strict-optional (may suppress certain other errors in
167              non-whitelisted files)
168
169   Warnings:
170              Detect code that is sound but redundant or problematic.
171
172       --warn-redundant-casts
173              Warn about casting an expression to its inferred type  (inverse:
174              --no-warn-redundant-casts)
175
176       --warn-unused-ignores
177              Warn   about   unneeded  '#  type:  ignore'  comments  (inverse:
178              --no-warn-unused-ignores)
179
180       --no-warn-no-return
181              Do not warn about functions that end without returning (inverse:
182              --warn-no-return)
183
184       --warn-return-any
185              Warn  about returning values of type Any from nonAny typed func‐
186              tions (inverse: --no-warn-returnany)
187
188   Other strictness checks:
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       --strict
198              Strict mode; enables the following flags:  --warnunused-configs,
199              --disallow-subclassing-any,   --disallow-any-generics,  --disal‐
200              low-untyped-calls,  --disallow-untyped-defs,   --disallow-incom‐
201              pletedefs,  --check-untyped-defs,  --disallow-untypeddecorators,
202              --no-implicit-optional,                   --warnredundant-casts,
203              --warn-unused-ignores, --warnreturn-any
204
205   Incremental mode:
206              Adjust  how  mypy  incrementally type checks and caches modules.
207              Mypy caches type information about modules into a cache  to  let
208              you  speed up future invocations of mypy. Also see mypy's daemon
209              mode: mypy.readthedocs.io/en/latest/mypy_daemon.html#mypy-daemon
210
211       --no-incremental
212              Disable module cache (inverse: --incremental)
213
214       --cache-dir DIR
215              Store module cache info in the given folder in incremental  mode
216              (defaults to '.mypy_cache')
217
218       --sqlite-cache
219              Use   a   sqlite   database   to   store   the  cache  (inverse:
220              --no-sqlite-cache)
221
222       --cache-fine-grained
223              Include fine-grained dependency information in the cache for the
224              mypy daemon
225
226       --skip-version-check
227              Allow using cache written by older mypy version
228
229   Mypy internals:
230              Debug and customize mypy internals.
231
232       --pdb  Invoke pdb on fatal error
233
234       --show-traceback, --tb
235              Show traceback on fatal error
236
237       --raise-exceptions
238              Raise exception on fatal error
239
240       --custom-typing MODULE
241              Use a custom typing module
242
243       --custom-typeshed-dir DIR
244              Use the custom typeshed in DIR
245
246       --warn-incomplete-stub
247              Warn  if missing type annotation in typeshed, only relevant with
248              --disallow-untyped-defs  or  --disallow-incomplete-defs  enabled
249              (inverse: --nowarn-incomplete-stub)
250
251       --shadow-file SOURCE_FILE SHADOW_FILE
252              When  encountering SOURCE_FILE, read and type check the contents
253              of SHADOW_FILE instead.
254
255   Error reporting:
256              Adjust the amount of detail shown in error messages.
257
258       --show-error-context
259              Precede  errors  with  "note:"   messages   explaining   context
260              (inverse: --hide-error-context)
261
262       --show-column-numbers
263              Show  column  numbers  in  error  messages (inverse: --hide-col‐
264              umn-numbers)
265
266   Report generation:
267              Generate a report in the specified format.
268
269       --any-exprs-report DIR
270
271       --cobertura-xml-report DIR
272
273       --html-report DIR
274
275       --linecount-report DIR
276
277       --linecoverage-report DIR
278
279       --memory-xml-report DIR
280
281       --txt-report DIR
282
283       --xml-report DIR
284
285       --xslt-html-report DIR
286
287       --xslt-txt-report DIR
288
289   Miscellaneous:
290       --junit-xml JUNIT_XML
291              Write junit.xml to the given file
292
293       --scripts-are-modules
294              Script x becomes module x instead of __main__
295
296       --find-occurrences CLASS.MEMBER
297              Print out all usages of a class member (experimental)
298
299   Running code:
300              Specify the code you want to type check. For more  details,  see
301              mypy.readthedocs.io/en/latest/running_mypy.html#running-mypy
302
303       -m MODULE, --module MODULE
304              Type-check module; can repeat for more modules
305
306       -p PACKAGE, --package PACKAGE
307              Type-check package recursively; can be repeated
308
309       -c PROGRAM_TEXT, --command PROGRAM_TEXT
310              Type-check program passed in as string
311
312       files  Type-check given files or directories
313
314   Environment variables:
315              Define MYPYPATH for additional module search path entries.
316
317
318
319mypy 0.670-dev                   February 2019                         MYPY(1)
Impressum