Skip to content

ci(python): fold the build task into test and check the stub - #3980

Open
ethanlin01x wants to merge 6 commits into
apache:masterfrom
ethanlin01x:ci/python-stub-gate
Open

ci(python): fold the build task into test and check the stub#3980
ethanlin01x wants to merge 6 commits into
apache:masterfrom
ethanlin01x:ci/python-stub-gate

Conversation

@ethanlin01x

@ethanlin01x ethanlin01x commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Which issue does this PR address?

Closes #3977

Rationale

Each task in components.yml becomes its own job, so sdk-python compiled the same crate twice per push. Folding build into test also gives apache_iggy.pyi somewhere cheap to be checked, which it has never had.

What changed?

  1. build is folded into test. maturin build -o dist runs there, ahead of the coverage build so pytest still gets the instrumented module. lint stays its own job.
  2. test now checks that apache_iggy.pyi is in sync: regenerate, normalise with ruff, diff. The stub had already drifted, so the first commit is the regeneration.
  3. stub_gen is anchored on CARGO_MANIFEST_DIR. Running it from a subdirectory used to strip the license header off the tracked stub, which the README carried as a known bug. That TODO is gone.

Local Execution

  • Passed
  • Pre-commit hooks ran

AI Usage

If AI tools were used, please answer:

  1. Which tools? Claude
  2. Scope of usage? help implement and review this PR
  3. How did you verify the generated code works correctly? Unit tests pin each rejected value and each still-legal zero
  4. Can you explain every line of the code if asked? Yes, all the changes are checked by the human.

The build task compiled the wheel and threw it away: its dist/ never
reached the artifact upload, which only runs under test. Building it in
test instead keeps the same coverage on one runner and makes the wheel
reach the upload it was always listed in.

Closes apache#3977
The tracked stub had drifted from stub_gen output. Two docstrings were
hand-edited to drop a rustdoc intra-doc link, which renders as noise in
Python, so the link is now plain backticks at the source instead.
Nothing verified stub freshness, so the file could drift from the pyo3
source unnoticed. The check needs a built crate, so it sits in test next
to the wheel build rather than in lint.
Running it from a subdirectory stripped the license header from the
tracked stub: `stub.generate()` writes to the crate root, but the header
was prepended through a path resolved against the current directory.
@ethanlin01x
ethanlin01x marked this pull request as ready for review August 27, 2026 14:57
@github-actions github-actions Bot added the S-waiting-on-review PR is waiting on a reviewer label Aug 27, 2026
@ethanlin01x

Copy link
Copy Markdown
Contributor Author

/request-review @hubcio @slbotbm @jiengup

@github-actions

Copy link
Copy Markdown

/request-review: could not request hubcio, slbotbm, jiengup - a handle is not a repo collaborator, or the team is unknown.

@ethanlin01x

Copy link
Copy Markdown
Contributor Author

/request-review @hubcio @slbotbm

@github-actions
github-actions Bot requested review from hubcio and slbotbm August 27, 2026 15:03
@codecov

codecov Bot commented Aug 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.62%. Comparing base (0fdf9d6) to head (6e25d78).

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #3980      +/-   ##
============================================
+ Coverage     84.26%   84.62%   +0.35%     
  Complexity     1398     1398              
============================================
  Files          1219     1221       +2     
  Lines        173644   175752    +2108     
  Branches     140742   142852    +2110     
============================================
+ Hits         146317   148722    +2405     
+ Misses        23369    23029     -340     
- Partials       3958     4001      +43     
Components Coverage Δ
Rust Core 85.52% <ø> (+0.43%) ⬆️
Java SDK 67.23% <ø> (ø)
C# SDK 75.32% <ø> (-0.08%) ⬇️
Python SDK 90.06% <ø> (ø)
PHP SDK 85.65% <ø> (ø)
Node SDK 96.07% <ø> (ø)
Go SDK 69.09% <ø> (ø)
Files with missing lines Coverage Δ
foreign/python/src/topic.rs 83.52% <ø> (ø)

... and 82 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jiengup

jiengup commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

LGTM

@ethanlin01x

Copy link
Copy Markdown
Contributor Author

I think the Go e2e failure is a flake, unrelated to this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review PR is waiting on a reviewer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants