pytorch
/
mypy.ini
299 строк · 5.9 Кб
1# This is the PyTorch mypy.ini file (note: don't change this line! -
2# test_run_mypy in test/test_type_hints.py uses this string)
3
4[mypy]
5plugins = mypy_plugins/check_mypy_version.py, mypy_plugins/sympy_mypy_plugin.py, numpy.typing.mypy_plugin
6
7cache_dir = .mypy_cache/normal
8allow_redefinition = True
9warn_unused_configs = True
10warn_redundant_casts = True
11show_error_codes = True
12show_column_numbers = True
13check_untyped_defs = True
14follow_imports = normal
15local_partial_types = True
16enable_error_code = possibly-undefined
17
18# do not reenable this:
19# https://github.com/pytorch/pytorch/pull/60006#issuecomment-866130657
20warn_unused_ignores = False
21
22#
23# Note: test/ still has syntax errors so can't be added
24#
25# Typing tests is low priority, but enabling type checking on the
26# untyped test functions (using `--check-untyped-defs`) is still
27# high-value because it helps test the typing.
28#
29
30files =
31torch,
32caffe2,
33test/test_bundled_images.py,
34test/test_bundled_inputs.py,
35test/test_complex.py,
36test/test_datapipe.py,
37test/test_futures.py,
38test/test_numpy_interop.py,
39test/test_torch.py,
40test/test_type_hints.py,
41test/test_type_info.py
42test/test_utils.py
43
44#
45# `exclude` is a regex, not a list of paths like `files` (sigh)
46#
47exclude = torch/include/|torch/csrc/|torch/distributed/elastic/agent/server/api.py|torch/testing/_internal|torch/distributed/fsdp/fully_sharded_data_parallel.py
48
49python_version = 3.11
50
51
52#
53# Extension modules without stubs.
54#
55
56[mypy-torch._C._jit_tree_views]
57ignore_missing_imports = True
58
59[mypy-torch.for_onnx.onnx]
60ignore_missing_imports = True
61
62[mypy-torch.ao.quantization.experimental.apot_utils]
63ignore_missing_imports = True
64
65[mypy-torch.ao.quantization.experimental.quantizer]
66ignore_missing_imports = True
67
68[mypy-torch.ao.quantization.experimental.observer]
69ignore_missing_imports = True
70
71[mypy-torch.ao.quantization.experimental.APoT_tensor]
72ignore_missing_imports = True
73
74[mypy-torch.ao.quantization.experimental.fake_quantize_function]
75ignore_missing_imports = True
76
77[mypy-torch.ao.quantization.experimental.fake_quantize]
78ignore_missing_imports = True
79
80#
81# Files with various errors. Mostly real errors, possibly some false
82# positives as well.
83#
84
85[mypy-test_torch]
86check_untyped_defs = False
87
88# Excluded from mypy due to OpInfos being annoying to type
89[mypy-torch.testing._internal.common_methods_invocations.*]
90ignore_errors = True
91
92[mypy-torch.testing._internal.hypothesis_utils.*]
93ignore_errors = True
94
95[mypy-torch.testing._internal.common_quantization.*]
96ignore_errors = True
97
98[mypy-torch.testing._internal.generated.*]
99ignore_errors = True
100
101[mypy-torch.testing._internal.distributed.*]
102ignore_errors = True
103
104[mypy-torch.nn.modules.pooling]
105ignore_errors = True
106
107[mypy-torch.nn.parallel._functions]
108ignore_errors = True
109
110[mypy-torch._appdirs]
111ignore_errors = True
112
113[mypy-torch.multiprocessing.pool]
114ignore_errors = True
115
116[mypy-torch.overrides]
117ignore_errors = True
118
119#
120# Files with 'type: ignore' comments that are needed if checked with mypy-strict.ini
121#
122
123[mypy-tools.render_junit]
124warn_unused_ignores = False
125
126[mypy-tools.generate_torch_version]
127warn_unused_ignores = False
128
129#
130# Adding type annotations to caffe2 is probably not worth the effort
131# only work on this if you have a specific reason for it, otherwise
132# leave these ignores as they are.
133#
134
135[mypy-caffe2.python.*]
136ignore_errors = True
137
138[mypy-caffe2.proto.*]
139ignore_errors = True
140
141[mypy-caffe2.core.nomnigraph.op_gen]
142ignore_errors = True
143
144[mypy-caffe2.distributed.store_ops_test_util]
145ignore_errors = True
146
147[mypy-caffe2.experiments.*]
148ignore_errors = True
149
150[mypy-caffe2.contrib.*]
151ignore_errors = True
152
153[mypy-caffe2.quantization.server.*]
154ignore_errors = True
155
156#
157# Third party dependencies that don't have types.
158#
159
160[mypy-triton.*]
161ignore_missing_imports = True
162
163[mypy-tensorflow.*]
164ignore_missing_imports = True
165
166[mypy-tensorboard.*]
167ignore_missing_imports = True
168
169[mypy-onnx.*]
170ignore_missing_imports = True
171
172[mypy-matplotlib.*]
173ignore_missing_imports = True
174
175[mypy-numpy.*]
176ignore_missing_imports = True
177
178[mypy-sympy]
179ignore_missing_imports = True
180
181[mypy-sympy.*]
182ignore_missing_imports = True
183
184[mypy-hypothesis.*]
185ignore_missing_imports = True
186
187[mypy-tqdm.*]
188ignore_missing_imports = True
189
190[mypy-multiprocessing.*]
191ignore_missing_imports = True
192
193[mypy-setuptools.*]
194ignore_missing_imports = True
195
196[mypy-distutils.*]
197ignore_missing_imports = True
198
199[mypy-nvd3.*]
200ignore_missing_imports = True
201
202[mypy-future.utils]
203ignore_missing_imports = True
204
205[mypy-past.builtins]
206ignore_missing_imports = True
207
208[mypy-numba.*]
209ignore_missing_imports = True
210
211[mypy-PIL.*]
212ignore_missing_imports = True
213
214[mypy-moviepy.*]
215ignore_missing_imports = True
216
217[mypy-cv2.*]
218ignore_missing_imports = True
219
220[mypy-torchvision.*]
221ignore_missing_imports = True
222
223[mypy-pycuda.*]
224ignore_missing_imports = True
225
226[mypy-tensorrt.*]
227ignore_missing_imports = True
228
229[mypy-tornado.*]
230ignore_missing_imports = True
231
232[mypy-pydot.*]
233ignore_missing_imports = True
234
235[mypy-networkx.*]
236ignore_missing_imports = True
237
238[mypy-scipy.*]
239ignore_missing_imports = True
240
241[mypy-IPython.*]
242ignore_missing_imports = True
243
244[mypy-google.protobuf.textformat]
245ignore_missing_imports = True
246
247[mypy-lmdb.*]
248ignore_missing_imports = True
249
250[mypy-mpi4py.*]
251ignore_missing_imports = True
252
253[mypy-skimage.*]
254ignore_missing_imports = True
255
256[mypy-librosa.*]
257ignore_missing_imports = True
258
259[mypy-mypy.*]
260ignore_missing_imports = True
261
262[mypy-xml.*]
263ignore_missing_imports = True
264
265[mypy-boto3.*]
266ignore_missing_imports = True
267
268[mypy-dill.*]
269ignore_missing_imports = True
270
271[mypy-usort.*]
272ignore_missing_imports = True
273
274[mypy-torch._inductor.*]
275disallow_any_generics = True
276
277[mypy-torch._dynamo.*]
278disallow_any_generics = True
279
280[mypy-cutlass_library.*]
281ignore_missing_imports = True
282
283[mypy-deeplearning.*]
284ignore_missing_imports = True
285
286[mypy-einops.*]
287ignore_missing_imports = True
288
289[mypy-libfb.*]
290ignore_missing_imports = True
291
292[mypy-torch.*.fb.*]
293ignore_missing_imports = True
294
295[mypy-torch.fb.*]
296ignore_missing_imports = True
297
298[mypy-torch_xla.*]
299ignore_missing_imports = True
300