diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index d1472771..d7f7e230 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -97,3 +97,11 @@ jobs: - name: Run lit tests run: | cmake --build ${SUBSTRAIT_MLIR_MAIN_BINARY_DIR} --target check-substrait-mlir + + # Run this as part of the `build` job because we need the `build` folder. + - name: Run pyright to test if typing annotations are correct + uses: jakebailey/pyright-action@v2 + with: + stats: true + working-directory: substrait-mlir + project: pyproject.toml diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..4895e50b --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,19 @@ +[tool.pyright] + +# Point `pyright` to the built files rather than those in the source tree +# because relative imports won't work in the latter case. (They work in the +# former because the build process copies files from several places.) +include = [ + 'test/python/', + 'build/tools/substrait_mlir/python_packages/substrait_mlir/dialects/substrait.py', + 'build/tools/substrait_mlir/python_packages/substrait_mlir/_mlir_libs/_substraitDialects/', + ] + +exclude = [ + '**/lit.cfg.py', + ] + +extraPaths = [ + 'build/tools/mlir/python_packages/', + 'build/tools/substrait_mlir/python_packages/', + ]