Skip to content

Commit b85cf74

Browse files
authored
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.
1 parent eff0040 commit b85cf74

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: mypy-presubmit
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- "samples/python/**"
7+
- ".github/workflows/mypy-presubmit.yml"
8+
9+
jobs:
10+
type-check:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v3
16+
17+
- name: Set up Python
18+
uses: actions/setup-python@v4
19+
with:
20+
python-version: "3.11"
21+
22+
- name: Install dependencies
23+
run: |
24+
python -m pip install --upgrade pip
25+
pip install mypy
26+
pip install -r samples/python/requirements.txt || true
27+
28+
- name: Run mypy on samples
29+
run: |
30+
mypy samples/python --ignore-missing-imports

0 commit comments

Comments
 (0)