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