Skip to main content

openframe-protocol-grpc

gRPC server and client binding, the second transport (after HTTP) to prove openframe-protocol-base's conformance suites for real. Wires a QueryHandler/CommandHandler/UseCase (openframe.core.inbound) to a grpc.aio.Server, and provides GrpcRemoteQueryClient/ GrpcRemoteCommandClient for calling another service built on this platform — through the same shared error mapper and RequestContext builder openframe-protocol-http uses, not a parallel implementation.

One generic RPC (GenericService.Call, {json_payload: string} in both directions) instead of one per route — the domain type travels as JSON inside the payload, the gRPC equivalent of -http's dynamic inspect.Signature trick for avoiding a per-route message type.

Install the [server] extra for a server, [client] extra to call one — both pull in grpcio (unlike HTTP, there's no separate client-only wire library for gRPC, but the extras split is kept for symmetry with every other openframe-protocol-* package).

Server-side wiring example

from openframe.protocol.grpc import bind_service

server = grpc.aio.server()

bind_service(
    server, "get_item",
    handler_factory=get_get_item_handler,
    not_found_when=lambda item: item is None,
)
bind_service(
    server, "create_item",
    handler_factory=get_create_item_handler,
)

server.add_insecure_port("[::]:50051")
await server.start()

Client-side wiring example

from openframe.protocol.grpc import GrpcRemoteQueryClient

get_item = GrpcRemoteQueryClient(target="items-service:50051", route="get_item")
item = await get_item.execute("abc-123")

Streaming — bind_service_stream

GenericService also has CallStream (stream GenericRequest → stream GenericResponse), the bidirectional-streaming counterpart to Call — the SessionHandler (ADR-008, openframe-core) binding for long-lived connections, same route-multiplexing trick (x-openframe-route metadata). Needed no new dependency — grpcio already supports streaming natively; this package simply hadn't used it until now:

from openframe.protocol.grpc import bind_service_stream

bind_service_stream(server, "artifact_updates", handler_factory=lambda: ArtifactUpdates())

on_open runs — and can reject — before the method's first yield, mirroring bind_service's own reject path exactly. A real race not present in -http's own session transports (SSE, WebSocket): the inbound request_iterator and the method's own outbound yield loop are two independently-scheduled grpc.aio signals for the same disconnect, confirmed by spiking to resolve consistently (not randomly) in one specific order — see openframe.protocol.grpc.server's own module docstring for the full finding and fix (polling context.cancelled() for a short window rather than trusting the inbound side ending on its own).

Status

Experimental, M4 of the project's own build plan. TransportConformanceTests, RemoteClientConformanceTests, and SessionConformanceTests (all openframe-protocol-base) pass against this package for real — the point of building it: proving the architecture generalizes past HTTP, not just adding a second transport for its own sake.

Metadata

Release files for openframe-protocol-grpc 0.4.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for openframe-protocol-grpc 0.4.2
File Size Uploaded Provenance
openframe_protocol_grpc-0.4.2.tar.gz 25.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for openframe-protocol-grpc 0.4.2
File Interpreter ABI Platform
openframe_protocol_grpc-0.4.2-py3-none-any.whl Python 3 none any Details

Total release size: 44.3 kB

Release files / openframe_protocol_grpc-0.4.2.tar.gz

Download URL openframe_protocol_grpc-0.4.2.tar.gz
Size 25.0 kB
Tags Source
SHA-256 checksum
How to use checksums
665cbb2a77dcd563ece0593547b01625b678d03bc97733afef34ad8b402b8e9e
BLAKE2b-256 checksum
How to use checksums
5be181835fc0d5906063d7b6f408a4192ae02de354e8ca7f98d9046898fa12f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / openframe_protocol_grpc-0.4.2-py3-none-any.whl

Download URL openframe_protocol_grpc-0.4.2-py3-none-any.whl
Size 19.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e73473852510c35bed6d7a1ce0168ad2366ddf2e5b5d299888edf54ce1ab36a3
BLAKE2b-256 checksum
How to use checksums
1b722a40d64a29dfd7085b438d279f297addfec02146f7b9cb4bdd462433d96e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for openframe-protocol-grpc 0.4.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page