Skip to content

fix(python): commit proto stubs so sdist-based builds produce working wheels - #2598

Open
andre-motta wants to merge 1 commit into
NVIDIA:mainfrom
andre-motta:fix/maturin-protobuf-include-paths
Open

fix(python): commit proto stubs so sdist-based builds produce working wheels#2598
andre-motta wants to merge 1 commit into
NVIDIA:mainfrom
andre-motta:fix/maturin-protobuf-include-paths

Conversation

@andre-motta

@andre-motta andre-motta commented Aug 3, 2026

Copy link
Copy Markdown

Summary

Commit the generated protobuf/gRPC stubs under python/openshell/_proto/ so
that PEP 517 builds from the source tarball produce importable wheels. Previously
the stubs were gitignored and only generated through the mise task graph, so any
standard build frontend (pip, build, fromager) that started from the sdist shipped
an empty _proto/ directory and failed at import openshell._proto.

Heads up on the diff size: the +7k lines are almost entirely the 15 auto-generated
protobuf stubs (*_pb2.py, *_pb2_grpc.py, *.pyi) that were previously gitignored
and only existed as transient build artifacts.

This PR promotes them to tracked files so they ship in the sdist. The actual project
changes (gitignore, pyproject.toml, CI workflow, mise task, docs) are under 50 lines.
Future PRs that touch .proto files will only show the regenerated diff for the affected
stubs, not the full set.

Related Issue

Closes #2596

Changes

  • Remove the .gitignore rules that excluded python/openshell/_proto/*
  • Commit the 15 generated stub files (*_pb2.py, *_pb2_grpc.py, *.pyi)
  • Remove the [tool.maturin].include globs that were a workaround for the
    gitignored stubs (maturin now discovers them normally via python-source)
  • Add a python:proto:check mise task that regenerates stubs and runs
    git diff --exit-code to catch staleness
  • Wire the freshness check into branch-checks.yml (Python job) and the
    lint task (so mise run pre-commit catches it locally)
  • Update architecture/build.md and CONTRIBUTING.md with the new workflow

Note on determinism

The generated output is identical across Python versions (tested 3.12 vs 3.14)
because grpcio-tools is pinned via uv.lock. Contributors regenerate with
mise run python:proto after changing any .proto file and commit the result.

Testing

  • mise run pre-commit passes
  • Verified sdist includes all proto stubs (tar tzf inspection)
  • Verified wheel built from git checkout includes stubs (unzip -l)
  • Confirmed proto generation output is identical between Python 3.12 and 3.14
  • Updated GitHub and mirrored E2E checks for the latest head

Checklist

… wheels

Proto stubs under python/openshell/_proto/ were gitignored and only
generated through the mise task graph. Any PEP 517 build from sdist
(pip, build, fromager) produced a wheel with an empty _proto/ directory,
causing import failures. Commit the generated stubs, remove the maturin
include workaround, and add a CI freshness check that regenerates and
diffs to catch stale stubs.

Closes NVIDIA#2596

Signed-off-by: Andre Lustosa <alustosa@redhat.com>
@copy-pr-bot

copy-pr-bot Bot commented Aug 3, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

Thank you for your submission! We ask that you sign our Developer Certificate of Origin before we can accept your contribution. You can sign the DCO by adding a comment below using this text:


I have read the DCO document and I hereby sign the DCO.


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the DCO Assistant Lite bot.

@andre-motta

Copy link
Copy Markdown
Author

I have read the DCO document and I hereby sign the DCO.

@andre-motta

Copy link
Copy Markdown
Author

recheck

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(python): PEP 517 builds from sdist produce wheels with missing proto stubs

1 participant