File tree 4 files changed +39
-2
lines changed 4 files changed +39
-2
lines changed Original file line number Diff line number Diff line change @@ -191,6 +191,28 @@ section of the command line docs.
191
191
192
192
This option may only be set in the global section (``[mypy] ``).
193
193
194
+ .. confval :: modules
195
+
196
+ :type: comma-separated list of strings
197
+
198
+ A comma-separated list of packages which should be checked by mypy if none are given on the command
199
+ line. Mypy *will not * recursively type check any submodules of the provided
200
+ module.
201
+
202
+ This option may only be set in the global section (``[mypy] ``).
203
+
204
+
205
+ .. confval :: packages
206
+
207
+ :type: comma-separated list of strings
208
+
209
+ A comma-separated list of packages which should be checked by mypy if none are given on the command
210
+ line. Mypy *will * recursively type check any submodules of the provided
211
+ package. This flag is identical to :confval: `modules ` apart from this
212
+ behavior.
213
+
214
+ This option may only be set in the global section (``[mypy] ``).
215
+
194
216
.. confval :: exclude
195
217
196
218
:type: regular expression
Original file line number Diff line number Diff line change @@ -161,6 +161,8 @@ def check_follow_imports(choice: str) -> str:
161
161
"python_executable" : expand_path ,
162
162
"strict" : bool ,
163
163
"exclude" : lambda s : [s .strip ()],
164
+ "packages" : try_split ,
165
+ "modules" : try_split ,
164
166
}
165
167
166
168
# Reuse the ini_config_types and overwrite the diff
@@ -178,6 +180,8 @@ def check_follow_imports(choice: str) -> str:
178
180
"enable_error_code" : lambda s : validate_codes (try_split (s )),
179
181
"package_root" : try_split ,
180
182
"exclude" : str_or_array_as_list ,
183
+ "packages" : try_split ,
184
+ "modules" : try_split ,
181
185
}
182
186
)
183
187
Original file line number Diff line number Diff line change @@ -1222,8 +1222,13 @@ def set_strict_flags() -> None:
1222
1222
1223
1223
# Paths listed in the config file will be ignored if any paths, modules or packages
1224
1224
# are passed on the command line.
1225
- if options .files and not (special_opts .files or special_opts .packages or special_opts .modules ):
1226
- special_opts .files = options .files
1225
+ if not (special_opts .files or special_opts .packages or special_opts .modules ):
1226
+ if options .files :
1227
+ special_opts .files = options .files
1228
+ if options .packages :
1229
+ special_opts .packages = options .packages
1230
+ if options .modules :
1231
+ special_opts .modules = options .modules
1227
1232
1228
1233
# Check for invalid argument combinations.
1229
1234
if require_targets :
Original file line number Diff line number Diff line change @@ -215,6 +215,12 @@ def __init__(self) -> None:
215
215
# supports globbing
216
216
self .files : list [str ] | None = None
217
217
218
+ # A list of packages for mypy to type check
219
+ self .packages : list [str ] | None = None
220
+
221
+ # A list of modules for mypy to type check
222
+ self .modules : list [str ] | None = None
223
+
218
224
# Write junit.xml to given file
219
225
self .junit_xml : str | None = None
220
226
You can’t perform that action at this time.
0 commit comments