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.0

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.0
File Size Uploaded Provenance
openframe_protocol_grpc-0.4.0.tar.gz 23.7 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 42.1 kB

Release files / openframe_protocol_grpc-0.4.0.tar.gz

Download URL openframe_protocol_grpc-0.4.0.tar.gz
Size 23.7 kB
Tags Source
SHA-256 checksum
How to use checksums
48ccc25e2c2a6a0b6293bbd1830fbe128f9421e5cd0b769af19d8e016e8a39ea
BLAKE2b-256 checksum
How to use checksums
3fab6a750a574061822e01de9d6070ad4240f8aa6cf45972a04df5ad04111196
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

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

Download URL openframe_protocol_grpc-0.4.0-py3-none-any.whl
Size 18.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
25811801c80faa00585475629f98ce40dfe8eab0b5a23d263e59d98289640490
BLAKE2b-256 checksum
How to use checksums
7bb89e756a05bc7dbc5168820f1e43518df5c69d4ce8596595b547340fb25988
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Security for openframe-protocol-grpc 0.4.0

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