@@ -108,6 +108,7 @@ actionlint = ">=1.7.12,<2"
108108blacken-docs = " >=1.20.0,<2"
109109pytest = " >=9.0.2,<10"
110110validate-pyproject = " >=0.25,<0.26"
111+ pyrefly = " >=0.61.1,<0.62"
111112# NOTE: don't add cupy, jax, pytorch, or sparse here,
112113# as they slow down mypy and are not portable across target OSs
113114
@@ -117,6 +118,7 @@ hooks = { cmd = "lefthook install", description = "Install pre-commit hooks" }
117118pre-commit = { cmd = " lefthook run pre-commit" , description = " Run pre-commit checks" }
118119pylint = { cmd = " pylint array_api_extra" , cwd = " src" , description = " Lint with pylint" }
119120mypy = { cmd = " mypy" , description = " Type check with mypy" }
121+ pyrefly = { cmd = " pyrefly check" , description = " Type check with pyrefly" }
120122pyright = { cmd = " basedpyright" , description = " Type check with basedpyright" }
121123ruff-check = { cmd = " ruff check --fix" , description = " Lint with ruff" }
122124ruff-format = { cmd = " ruff format" , description = " Format with ruff" }
@@ -257,7 +259,7 @@ run.source = ["array_api_extra"]
257259# mypy
258260
259261[tool .mypy ]
260- files = [" src" , " tests" ]
262+ files = [" src" , " tests" , " vendor_tests " ]
261263python_version = " 3.11"
262264warn_unused_configs = true
263265strict = true
@@ -273,10 +275,46 @@ ignore_missing_imports = true
273275module = [" tests/*" ]
274276disable_error_code = [" no-untyped-def" ] # test(...) without -> None
275277
278+ [[tool .mypy .overrides ]]
279+ module = [" vendor_tests/*" ]
280+ disable_error_code = [" no-untyped-def" ] # test(...) without -> None
281+
282+ [[tool .mypy .overrides ]]
283+ module = [" vendor_tests/array_api_compat/*" ]
284+ ignore_errors = true
285+
286+ # pyrefly
287+
288+ [tool .pyrefly .errors ]
289+ # Redundant with mypy checks
290+ missing-import = false
291+ # extra checks from scipy/scipy-stubs
292+ implicit-abstract-class = " error"
293+ implicitly-defined-attribute = " error"
294+ missing-override-decorator = " error"
295+ missing-source = " ignore"
296+ not-required-key-access = " error"
297+ open-unpacking = " error"
298+ unannotated-attribute = " error"
299+ unannotated-parameter = " error"
300+ unannotated-return = " error"
301+ untyped-import = " error"
302+ unused-ignore = " error"
303+ variance-mismatch = " error"
304+
305+ [[tool .pyrefly .sub-config ]]
306+ matches = " tests/*.py"
307+ errors = { unannotated-return = false }
308+
309+ [[tool .pyrefly .sub-config ]]
310+ matches = " vendor_tests/*.py"
311+ errors = { unannotated-return = false }
312+
276313# pyright
277314
278315[tool .basedpyright ]
279- include = [" src" , " tests" ]
316+ include = [" src" , " tests" , " vendor_tests" ]
317+ exclude = [" vendor_tests/array_api_compat" ]
280318pythonVersion = " 3.11"
281319pythonPlatform = " All"
282320typeCheckingMode = " all"
0 commit comments