File tree 2 files changed +29
-4
lines changed
2 files changed +29
-4
lines changed Original file line number Diff line number Diff line change @@ -903,6 +903,20 @@ Miscellaneous
903
903
selection of third-party package stubs, instead of having
904
904
them installed separately.
905
905
906
+ .. option :: --non-interactive
907
+
908
+ When used together with :option: `--install-types <mypy
909
+ --install-types> `, this causes mypy to install all suggested stub
910
+ packages using pip without asking for confirmation, and then
911
+ continues to perform type checking using the installed stubs, if
912
+ some files or modules are provided to type check.
913
+
914
+ This is implemented as up to two mypy runs internally. The first run
915
+ is used to find missing stub packages, and output is shown from
916
+ this run only if no missing stub packages were found. If missing
917
+ stub packages were found, they are installed and then another run
918
+ is performed.
919
+
906
920
.. option :: --junit-xml JUNIT_XML
907
921
908
922
Causes mypy to generate a JUnit XML test result document with
Original file line number Diff line number Diff line change @@ -182,10 +182,21 @@ mypy run. You can also use your normal mypy command line with the
182
182
extra :option: `--install-types <mypy --install-types> ` option to
183
183
install missing stubs at the end of the run (if any were found).
184
184
185
- You can also get this message if the stubs only support Python 3 and
186
- your target Python version is Python 2, or vice versa. In this case
187
- follow instructions in
188
- :ref: `missing-type-hints-for-third-party-library `.
185
+ Use :option: `--install-types <mypy --install-types> ` with
186
+ :option: `--non-interactive <mypy --non-interactive> ` to install all suggested
187
+ stub packages without asking for confirmation, *and * type check your
188
+ code, in a single command:
189
+
190
+ .. code-block :: text
191
+
192
+ mypy --install-types --non-interactive src/
193
+
194
+ This can be useful in Continuous Integration jobs if you'd prefer not
195
+ to manage stub packages manually. This is somewhat slower than
196
+ explicitly installing stubs before running mypy, since it may type
197
+ check your code twice -- the first time to find the missing stubs, and
198
+ the second time to type check your code properly after mypy has
199
+ installed the stubs.
189
200
190
201
.. _missing-type-hints-for-third-party-library :
191
202
You can’t perform that action at this time.
0 commit comments