xref: /aosp_15_r20/external/pytorch/mypy-strict.ini (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1# This is the PyTorch mypy-strict.ini file (note: don't change this line! -
2# test_run_mypy in test/test_type_hints.py uses this string)
3
4# Unlike mypy.ini, it enforces very strict typing rules. The intention is for
5# this config file to be used to ENFORCE that people are using mypy on codegen
6# files.
7
8[mypy]
9python_version = 3.8
10plugins = mypy_plugins/check_mypy_version.py, numpy.typing.mypy_plugin
11
12cache_dir = .mypy_cache/strict
13allow_redefinition = True
14strict_optional = True
15show_error_codes = True
16show_column_numbers = True
17warn_no_return = True
18disallow_any_unimported = True
19
20strict = True
21implicit_reexport = False
22
23# do not reenable this:
24# https://github.com/pytorch/pytorch/pull/60006#issuecomment-866130657
25warn_unused_ignores = False
26
27files =
28    .github,
29    benchmarks/instruction_counts,
30    tools,
31    torch/profiler/_memory_profiler.py,
32    torch/utils/_pytree.py,
33    torch/utils/_cxx_pytree.py,
34    torch/utils/benchmark/utils/common.py,
35    torch/utils/benchmark/utils/timer.py,
36    torch/utils/benchmark/utils/valgrind_wrapper
37
38# Specifically enable imports of benchmark utils. As more of `torch` becomes
39# strict compliant, those modules can be enabled as well.
40[mypy-torch.utils.benchmark.utils.*]
41follow_imports = normal
42
43# Don't follow imports as much of `torch` is not strict compliant.
44[mypy-torch]
45follow_imports = skip
46
47[mypy-torch.*]
48follow_imports = skip
49
50# Missing stubs.
51
52[mypy-numpy]
53ignore_missing_imports = True
54
55[mypy-sympy]
56ignore_missing_imports = True
57
58[mypy-sympy.*]
59ignore_missing_imports = True
60
61[mypy-mypy.*]
62ignore_missing_imports = True
63
64[mypy-usort.*]
65ignore_missing_imports = True
66