[Mlir-commits] [mlir] [MLIR][Python] add pyrefly lit test (PR #186687)

Maksim Levental llvmlistbot at llvm.org
Sun Mar 15 11:05:54 PDT 2026


https://github.com/makslevental created https://github.com/llvm/llvm-project/pull/186687

None

>From 4d12538e7783a7563afa8a53d5c3be61cadc33ca Mon Sep 17 00:00:00 2001
From: makslevental <maksim.levental at gmail.com>
Date: Sun, 15 Mar 2026 11:04:59 -0700
Subject: [PATCH] [MLIR][Python] add pyrefly lit test

---
 mlir/python/pyrefly.toml       | 4 ++++
 mlir/python/requirements.txt   | 2 ++
 mlir/test/lit.cfg.py           | 4 ++++
 mlir/test/python/type_check.py | 1 +
 4 files changed, 11 insertions(+)
 create mode 100644 mlir/python/pyrefly.toml
 create mode 100644 mlir/test/python/type_check.py

diff --git a/mlir/python/pyrefly.toml b/mlir/python/pyrefly.toml
new file mode 100644
index 0000000000000..013b8f69ccb94
--- /dev/null
+++ b/mlir/python/pyrefly.toml
@@ -0,0 +1,4 @@
+project-includes = [
+    "**/*.py*",
+    "**/*.ipynb",
+]
diff --git a/mlir/python/requirements.txt b/mlir/python/requirements.txt
index d7b89d5ce6b92..a52475faf56f7 100644
--- a/mlir/python/requirements.txt
+++ b/mlir/python/requirements.txt
@@ -6,3 +6,5 @@ typing_extensions>=4.12.2
 numpy>=1.19.5, <=2.1.2
 ml_dtypes>=0.1.0, <=0.6.0; python_version<"3.13"   # provides several NumPy dtype extensions, including the bf16
 ml_dtypes>=0.5.0, <=0.6.0; python_version>="3.13"
+# TEST dependencies
+pyrefly==0.56.0
diff --git a/mlir/test/lit.cfg.py b/mlir/test/lit.cfg.py
index a716ba0adb480..0a58ad1fce1f4 100644
--- a/mlir/test/lit.cfg.py
+++ b/mlir/test/lit.cfg.py
@@ -340,6 +340,9 @@ def find_real_python_interpreter():
 # by copying/linking sources to build.
 if config.enable_bindings_python:
     config.environment["PYTHONPATH"] = os.getenv("MLIR_LIT_PYTHONPATH", "")
+    config.substitutions.append(
+        ("%mlir_python_src_root", os.path.join(config.config.mlir_src_root, "python"))
+    )
     llvm_config.with_environment(
         "PYTHONPATH",
         [
@@ -360,6 +363,7 @@ def find_real_python_interpreter():
 if config.expensive_checks:
     config.available_features.add("expensive_checks")
 
+
 def have_host_jit_feature_support(feature_name):
     mlir_runner_exe = lit.util.which("mlir-runner", config.mlir_tools_dir)
 
diff --git a/mlir/test/python/type_check.py b/mlir/test/python/type_check.py
new file mode 100644
index 0000000000000..281cfe25a32f0
--- /dev/null
+++ b/mlir/test/python/type_check.py
@@ -0,0 +1 @@
+# RUN: %PYTHON -m pyrefly check --summarize-errors %mlir_python_src_root 2>&1 | FileCheck %s



More information about the Mlir-commits mailing list