3434 - 'rust/crates/sift_stream_bindings/**'
3535 - '.github/workflows/python_ci.yaml'
3636
37- test-python :
37+ static-checks :
3838 needs : [changes]
3939 if : |
4040 always() &&
@@ -49,53 +49,86 @@ jobs:
4949 with :
5050 ref : ${{ github.event.pull_request.head.sha }}
5151
52- - name : Set up Python
53- uses : actions /setup-python@v2
52+ - name : Set up uv
53+ uses : astral-sh /setup-uv@v6
5454 with :
55- python-version : " 3.8 "
55+ enable-cache : true
5656
57- - name : Pip install
58- id : install
59- run : |
60- python -m pip install --upgrade pip
61- pip install '.[ dev-all]'
57+ - name : Verify lockfile is up to date
58+ run : uv lock --check
59+
60+ - name : Install dependencies
61+ run : uv sync --extra dev-all
6262
6363 - name : Lint
64- run : |
65- ruff check
64+ run : uv run ruff check
6665
6766 - name : Format
68- run : |
69- ruff format --check
67+ run : uv run ruff format --check
7068
7169 - name : MyPy
72- run : |
73- mypy lib
70+ run : uv run mypy lib
7471
7572 # Re-run mypy with --platform=win32 so typeshed evaluates platform-gated
7673 # stubs (e.g. fcntl) as if we were on Windows. Catches imports that
7774 # would only fail at runtime on Windows.
7875 - name : MyPy (Windows platform)
79- run : |
80- mypy --platform=win32 lib
76+ run : uv run mypy --platform=win32 lib
8177
8278 - name : Pyright
83- run : |
84- pyright lib
79+ run : uv run pyright lib
8580
8681 - name : Check Stubs Generation
8782 working-directory : .
88- run : |
89- bash .githooks/pre-push-python/stubs.sh
83+ run : bash .githooks/pre-push-python/stubs.sh
9084
9185 - name : Check Extras Generation
9286 working-directory : .
93- run : |
94- bash .githooks/pre-push-python/extras.sh
87+ run : bash .githooks/pre-push-python/extras.sh
9588
96- - name : Pytest Unit Tests
89+ - name : Sync Stubs Mypy
90+ working-directory : python/lib
9791 run : |
98- pytest -m "not integration"
92+ uv run stubtest \
93+ --mypy-config-file ../pyproject.toml \
94+ sift_client.resources.sync_stubs
95+
96+ test-python :
97+ needs : [changes]
98+ if : |
99+ always() &&
100+ (github.event_name != 'pull_request' || needs.changes.outputs.python == 'true')
101+ runs-on : ubuntu-latest
102+ defaults :
103+ run :
104+ working-directory : python
105+ strategy :
106+ fail-fast : false
107+ matrix :
108+ # Floor (3.8, per `requires-python`). This is the bug class local
109+ # checks miss (devs run a newer Python; modern syntax slips into
110+ # code that runs on 3.8). Ceiling testing is rarely useful in
111+ # practice — Python's deprecation cycle is long and the project's
112+ # stdlib usage is conservative — so it stays available locally as
113+ # `./scripts/dev test-ceiling` rather than running on every PR.
114+ # The full 3.8-3.14 install matrix lives in `python_build.yaml`.
115+ python-version : ["3.8"]
116+ steps :
117+ - name : Checkout code
118+ uses : actions/checkout@v4
119+ with :
120+ ref : ${{ github.event.pull_request.head.sha }}
121+
122+ - name : Set up uv
123+ uses : astral-sh/setup-uv@v6
124+ with :
125+ enable-cache : true
126+
127+ - name : Install dependencies (Python ${{ matrix.python-version }})
128+ run : uv sync --python ${{ matrix.python-version }} --extra dev-all
129+
130+ - name : Pytest Unit Tests (Python ${{ matrix.python-version }})
131+ run : uv run --python ${{ matrix.python-version }} pytest -m "not integration"
99132
100133 # Disabling integration tests that interact with Sift until a better solution is implemented
101134 # - name: Pytest Integration Tests
@@ -104,26 +137,20 @@ jobs:
104137 # SIFT_REST_URI: ${{ vars.SIFT_REST_URI }}
105138 # SIFT_API_KEY: ${{ secrets.SIFT_API_KEY }}
106139 # run: |
107- # pytest -m "integration"
108-
109- - name : Sync Stubs Mypy
110- working-directory : python/lib
111- run : |
112- stubtest \
113- --mypy-config-file ../pyproject.toml \
114- sift_client.resources.sync_stubs
140+ # uv run --python ${{ matrix.python-version }} --no-project --with-editable '.[dev-all]' pytest -m "integration"
115141
116142 python-ci-status :
117143 if : always()
118- needs : [changes, test-python]
144+ needs : [changes, static-checks, test-python]
119145 runs-on : ubuntu-latest
120146 steps :
121147 - name : Check result
122148 run : |
123- result="${{ needs.test-python.result }}"
124- if [[ "$result" == "success" || "$result" == "skipped" ]]; then
125- echo "python-ci passed (test-python: $result)"
149+ static="${{ needs.static-checks.result }}"
150+ tests="${{ needs.test-python.result }}"
151+ if [[ ("$static" == "success" || "$static" == "skipped") && ("$tests" == "success" || "$tests" == "skipped") ]]; then
152+ echo "python-ci passed (static-checks: $static, test-python: $tests)"
126153 else
127- echo "python-ci failed (test-python: $result )"
154+ echo "python-ci failed (static-checks: $static, test-python: $tests )"
128155 exit 1
129156 fi
0 commit comments