From f521e82a4e80df502fa57e5852af14d8779dcbd1 Mon Sep 17 00:00:00 2001 From: Aaron Pollack Date: Fri, 22 Aug 2025 23:05:07 +0000 Subject: [PATCH] Update pyrefly config for better codenav (#161200) This fixes behavior in codenav by switching from `replace_imports_with_any` to `ignore-missing-imports` Pull Request resolved: https://github.com/pytorch/pytorch/pull/161200 Approved by: https://github.com/aorenste, https://github.com/albanD --- pyrefly.toml | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/pyrefly.toml b/pyrefly.toml index e0637473497..6b94aeb5c1c 100644 --- a/pyrefly.toml +++ b/pyrefly.toml @@ -1,4 +1,4 @@ -project_includes = [ +project-includes = [ "torch", "caffe2", "test/test_bundled_images.py", @@ -7,12 +7,11 @@ project_includes = [ "test/test_datapipe.py", "test/test_futures.py", "test/test_numpy_interop.py", - "test/test_torch.py", "test/test_type_hints.py", "test/test_type_info.py", "test/test_utils.py", ] -project_excludes = [ +project-excludes = [ "torch/include/**", "torch/csrc/**", "torch/distributed/elastic/agent/server/api.py", @@ -27,7 +26,7 @@ project_excludes = [ "*/__pycache__/**", "*/.*", ] -replace_imports_with_any = [ +ignore-missing-imports = [ "torch._C._jit_tree_views.*", "torch.for_onnx.onnx.*", "torch.ao.quantization.experimental.apot_utils.*", @@ -85,4 +84,16 @@ replace_imports_with_any = [ "redis.*" ] -untyped_def_behavior = "check-and-infer-return-any" \ No newline at end of file +untyped_def_behavior = "check-and-infer-return-any" + +# Shut off noisy errors +errors.implicit-import = false + +# We exclude test_torch.py because it is full of errors, but most functions lack type signatures, +# and mypy.ini specifies `check_untyped_defs = False` for this file. +# If you check even the unannotated stuff mypy produces 322 errors. +# "test/test_torch.py", +# Uncomment this file to check +# [[tool.pyrefly.sub-config]] +# matches = "test/test_torch.py" +# untyped-def-behavior = "skip-and-infer-return-any"