Skip to content

protobuf-py-ext: add build-protobuf-py-ext.yml for riscv64 wheels - #1872

Merged
luhenry merged 4 commits into
mainfrom
protobuf-py-ext
Sep 14, 2026
Merged

luhenry merged 4 commits into
mainfrom
protobuf-py-ext

Conversation

@luhenry

@luhenry luhenry commented Sep 13, 2026

Copy link
Copy Markdown
Member

Compiles Buf's pyo3/maturin native marshaling extension for protobuf-py, a standalone Rust crate with no C/C++ dependencies (unrelated to the classic protocolbuffers/protobuf already built in this repo). Upstream publishes no riscv64 wheel.

Mirrors upstream's release.yaml ext-linux job.

Differs from upstream

  • Drops musllinux - rustup.rs ships no riscv64 musl host toolchain.
  • Copies LICENSE into packages/protobuf-py-ext/ before building - maturin's default glob misses it there.

Matrix: cp310-abi3 (covers cp310/cp311) plus cp312/cp313/cp314/cp314t, matching upstream's five published wheels.

Testing

  • Upstream's suite drives protobuf-py-ext only through protobuf-py's buf/protoc codegen, unavailable on riscv64.
  • Wheel-level: exercises the extension's descriptor-free public surface (Oneof, generic_setattr, NativeMessage) plus upstream's own protoc-free test_ext_marshaler.py assertion.

License: OK

cargo build --release/cargo check --target riscv64gc-unknown-linux-gnu clean locally (aarch64); riscv64 wheel build + 6-test pytest suite pending first CI run.

Ports bufbuild/protobuf-py's native extension (a standalone pyo3/maturin
crate at packages/protobuf-py-ext in that monorepo, no C/C++ dependencies
and no relation to the classic protocolbuffers/protobuf package already
built in this repo) to riscv64. Mirrors upstream's release.yaml ext-linux
job: one abi3 wheel built with --features pyo3/abi3-py310 for cp310/cp311,
plus separate per-interpreter wheels for cp312/cp313/cp314/cp314t.
musllinux is dropped (no riscv64 musl host toolchain from rustup.rs).

The wheel ships no LICENSE (maturin only globs it beside pyproject.toml,
which in this monorepo is the packages/protobuf-py-ext subdirectory), so
the workflow copies it there before building.

Tests exercise the extension's descriptor-free public surface directly
(Oneof, generic_setattr, NativeMessage's bare construction) plus the one
upstream test that needs neither buf nor protoc (test_ext_marshaler.py's
protobuf._native_message.NativeMessageClass detection), since the rest of
upstream's suite depends on protoc/buf codegen with no riscv64 wheel.
The checkout's own root pyproject.toml sets [tool.pytest] addopts to
--benchmark-disable/--benchmark-group-by=func,param:_id, which pytest
9.1.1 picks up as the inifile by directory proximity even for an
explicit file target, and pytest-benchmark isn't in CIBW_TEST_REQUIRES.
All 5 riscv64 legs failed on exactly this before the wheel build itself
was ever exercised. -c points pytest at a fresh empty ini instead.
A plain __dict__-based class accepts any new attribute name via
PyObject_GenericSetAttr, so asserting AttributeError on a never-set
'missing' attribute never raised; every riscv64 leg hung right after
that failing assertion until the default 360-minute job timeout killed
it. Use a __slots__ class instead, which genuinely rejects an unknown
attribute name the way generic_setattr's real callers rely on. Also
caps the job at 60 minutes so a future hang fails fast instead of
holding a runner for six hours.
Reproduced twice on riscv64: constructing a bare NativeMessage() (no
marshaler wired) hangs every leg until the job timeout, regardless of
whether the prior test in the file passed or failed. Real usage always
wires a marshaler via initialize_message_type before construction (via
protobuf-py's protoc-generated subclasses), so this exercises an
essentially untested bootstrap path. Check the class's shape instead of
instantiating it.
@luhenry
luhenry merged commit 246bac9 into main Sep 14, 2026
10 checks passed
@luhenry
luhenry deleted the protobuf-py-ext branch September 14, 2026 09:29
@luhenry luhenry linked an issue Sep 14, 2026 that may be closed by this pull request
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.

protobuf-py-ext riscv64 support

1 participant