From 5aa0d13a995b64047d04ad4fc9c7359fec41c5f2 Mon Sep 17 00:00:00 2001 From: Zaggy1024 Date: Wed, 29 Apr 2026 22:08:13 -0500 Subject: [PATCH] Meta+CI: Add pyright type checking to lint_python.sh --- .github/actions/setup/action.yml | 2 +- Meta/Linters/lint_python.sh | 7 +++++++ pyproject.toml | 10 ++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index 5f7bcbea88..819fa4f1dd 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -66,7 +66,7 @@ runs: if ${{ inputs.type == 'build' }} ; then pip3 install pyyaml requests six else - pip3 install ruff + pip3 install pyright ruff fi - name: Ensure clang-cl is available diff --git a/Meta/Linters/lint_python.sh b/Meta/Linters/lint_python.sh index 6be2effe47..c76647f68e 100755 --- a/Meta/Linters/lint_python.sh +++ b/Meta/Linters/lint_python.sh @@ -31,11 +31,18 @@ else fi if (( ${#files[@]} )); then + if ! command -v pyright >/dev/null 2>&1 ; then + echo "Please install pyright: pip3 install pyright" + exit 1 + fi + if ! command -v ruff >/dev/null 2>&1 ; then echo "Please install ruff: pip3 install ruff" exit 1 fi + pyright "${files[@]}" + if [[ ${overwrite} -eq 0 ]] ; then ruff check "${files[@]}" ruff format --check "${files[@]}" diff --git a/pyproject.toml b/pyproject.toml index b8295ccd67..db53140504 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,3 +12,13 @@ extend-select = [ [tool.ruff.lint.isort] force-single-line = true lines-between-types = 1 + +[tool.pyright] +pythonVersion = "3.9" +extraPaths = ["Meta"] +exclude = [ + "**/node_modules", + "**/__pycache__", + "**/.*", + "**/lit.cfg.py", +]