Skip to content

CI: merge the Python SDK's three tasks into one job #3977

Description

@ethanlin01x

Description

sdk-python declares tasks: ["lint", "test", "build"], and each task becomes its own job on its own runner. The build task compiles the wheel and throws it away: its dist/ never reaches Upload test artifacts, which only runs under test. So the crate is compiled twice per push and nothing is shared between the jobs.

At the same time apache_iggy.pyi has no freshness gate. The file header says it is generated by pyo3_stub_gen, the README says "nothing in CI checks stub freshness", and the stub has already drifted from the source: describe_options sits in a different position with its return type written as builtins.list[OptionSpec], and two docstrings were edited by hand. Checking this needs a built crate, so today there is nowhere cheap to put the check.

Affected area / component

CI / build / tooling

Proposed solution

Drop the build task and move maturin build -o dist into test:

tasks: ["lint", "test"]
  • lint = ruff + cargo fmt + clippy + pyrefly, unchanged
  • test = wheel + stub check + pytest

Keeping lint separate preserves the per-task status in the checks list, and fail-fast: true on the SDK matrices already cancels test when lint fails, so nothing needs coordinating.

Then add the stub gate to test, right after the wheel is built:

cargo run --bin stub_gen
uv run --no-sync ruff format apache_iggy.pyi
uv run --no-sync ruff check --fix apache_iggy.pyi
git diff --exit-code -- apache_iggy.pyi

The ruff steps are required, not cosmetic: the tracked stub is stub_gen output after ruff, since .pre-commit-config.yaml runs ruff-check --fix and ruff-format over foreign/python/**/*.pyi. Format has to run before check, because the raw output leaves whitespace on blank lines, which check reports but only format fixes.

stub_gen costs a full rebuild in a lint-only job, because clippy leaves nothing behind, but about 10s after maturin build since only pyo3 and above rebuild when the extension-module feature drops out.

Alternatives considered

No response

Contribution

  • I'm willing to submit a pull request to implement this feature

Good first issue

  • I think this could be a good first issue for a new contributor

Metadata

Metadata

Assignees

Labels

CI/CDContinuous integration and deploymentgood first issueGood for newcomers

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions