[Mlir-commits] [llvm] [mlir] [MLIR][Python] add pyrefly lit test (PR #186687)
Maksim Levental
llvmlistbot at llvm.org
Sun Mar 15 11:35:11 PDT 2026
https://github.com/makslevental updated https://github.com/llvm/llvm-project/pull/186687
>From 8906bade12a1d63a3680487d2e7923c6130f1448 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
---
.ci/all_requirements.txt | 11 +++++++++++
mlir/python/pyrefly.toml | 4 ++++
mlir/python/requirements.txt | 2 ++
mlir/test/lit.cfg.py | 4 ++++
mlir/test/python/type_check.py | 1 +
5 files changed, 22 insertions(+)
create mode 100644 mlir/python/pyrefly.toml
create mode 100644 mlir/test/python/type_check.py
diff --git a/.ci/all_requirements.txt b/.ci/all_requirements.txt
index 32c1f43b7f9a1..ee92244e4b03f 100644
--- a/.ci/all_requirements.txt
+++ b/.ci/all_requirements.txt
@@ -484,6 +484,17 @@ pynacl==1.6.0 \
--hash=sha256:f46386c24a65383a9081d68e9c2de909b1834ec74ff3013271f1bca9c2d233eb \
--hash=sha256:f4b3824920e206b4f52abd7de621ea7a44fd3cb5c8daceb7c3612345dfc54f2e
# via pygithub
+pyrefly==0.56.0 \
+ --hash=sha256:1e5f53781875024086a5b9f31a89c57d2977487fc3f819d9255008ad34b86fe2 \
+ --hash=sha256:21f018f47debc0842b2c3072201e53c138ae32bcda4f3119bfc8d23f59c16b3e \
+ --hash=sha256:4683f5e8820d5fbfb84231b643b2c5f6cd40b982cac48ef756d4e3d9b09a39cc \
+ --hash=sha256:5478229b09f4bba5bfea000b5ba20ea405f62dc7619ea81197e7ea637d6cba8d \
+ --hash=sha256:95366056ceb224571b9f1c20e801d949f2c1fa2cf4ed6ceaadf85ca2ebe6fb27 \
+ --hash=sha256:ec6ab3f9e2c03bae8dfa520f52778f47b6762020929a664177d36aa3b941db22 \
+ --hash=sha256:f0440a4bbf119ab646468f360e0bd047df051352db1e5d5b9fd58f89e8458809 \
+ --hash=sha256:f4948021639288b1ccda5f124c9562dc7f0a2679111eb314fa266c7bfd9f8603 \
+ --hash=sha256:f84d21d9b9b58481eea02204e2f73cabb93751b21ab2cd99178b4bde24be6a82
+ # via -r mlir/python/requirements.txt
pyyaml==6.0.1 \
--hash=sha256:04ac92ad1925b2cff1db0cfebffb6ffc43457495c9b3c39d3fcae417d7125dc5 \
--hash=sha256:062582fca9fabdd2c8b54a3ef1c978d786e0f6b3a1510e0ac93ef59e0ddae2bc \
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..4bfae6ecf45cd 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.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..0068c5feed12f
--- /dev/null
+++ b/mlir/test/python/type_check.py
@@ -0,0 +1 @@
+# RUN: %PYTHON -m pyrefly check --summarize-errors %mlir_python_src_root | FileCheck %s
More information about the Mlir-commits
mailing list