From b85cf74857b17e809c1202aeee9301131534d68b Mon Sep 17 00:00:00 2001 From: Shriya Date: Wed, 3 Dec 2025 10:41:44 +0530 Subject: [PATCH] Add mypy presubmit workflow for Python samples This commit adds a GitHub Actions presubmit workflow that runs mypy on the Python samples directory. This helps detect type errors early and improves the overall user experience, as requested in issue #13303. The workflow runs on pull requests that modify Python sample files, installs mypy and the sample dependencies, and performs type checking with: mypy samples/python --ignore-missing-imports This presubmit aligns the samples with recommended typing practices and makes type failures visible before merge. Closes #13303. --- .github/workflows/mypy-presubmit.yml | 30 ++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/mypy-presubmit.yml diff --git a/.github/workflows/mypy-presubmit.yml b/.github/workflows/mypy-presubmit.yml new file mode 100644 index 00000000000..fa3d6799155 --- /dev/null +++ b/.github/workflows/mypy-presubmit.yml @@ -0,0 +1,30 @@ +name: mypy-presubmit + +on: + pull_request: + paths: + - "samples/python/**" + - ".github/workflows/mypy-presubmit.yml" + +jobs: + type-check: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.11" + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install mypy + pip install -r samples/python/requirements.txt || true + + - name: Run mypy on samples + run: | + mypy samples/python --ignore-missing-imports