Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

benzene-grpc

The gRPC edge of the Benzene Python port's wire contract. Ships the Benzene ↔ gRPC status mapping (wire-contracts.md §4.2) — the foundation of a gRPC transport binding.

Depends on benzene-core.

pip install benzene-grpc
from benzene.grpc import to_grpc, from_grpc, BENZENE_STATUS_TRAILER

to_grpc("not-found")            # -> "NotFound"
to_grpc("created")              # -> "OK"   (all success statuses collapse to OK)
from_grpc("InvalidArgument")    # -> "bad-request"

Because several Benzene statuses collapse to one gRPC code, a gRPC server MUST attach a benzene-status trailer carrying the raw status verbatim; a client, seeing it, uses it in preference to re-deriving from the code:

from_grpc("OK", trailer="created")   # -> "created"  (the trailer wins verbatim)

The mapping needs no grpcio dependency (codes are canonical name strings). The server/client transport builds on it and adds the [transport] extra:

pip install 'benzene-grpc[transport]'
from concurrent.futures import ThreadPoolExecutor
import grpc
from benzene.core import BenzeneMessageApplication
from benzene.grpc import add_benzene_handler, GrpcMessageSender

server = grpc.server(ThreadPoolExecutor(max_workers=8))
add_benzene_handler(server, BenzeneMessageApplication(registry))   # every topic -> a unary method
server.add_insecure_port("[::]:50051"); server.start()

sender = GrpcMessageSender(grpc.insecure_channel("localhost:50051"))   # a MessageSender
result = await sender.send_message("orders:place", {"sku": "A"})

The method name is the topic; the benzene-status trailer preserves the exact status across the codes that collapse to one gRPC code. Mirrors .NET's Benzene.Grpc, and contributes the benzene.grpc subpackage to the shared benzene namespace.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

benzene_grpc-0.1.0b1.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

benzene_grpc-0.1.0b1-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

Details for the file benzene_grpc-0.1.0b1.tar.gz.

File metadata

  • Download URL: benzene_grpc-0.1.0b1.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for benzene_grpc-0.1.0b1.tar.gz
Algorithm Hash digest
SHA256 f4f6af0de97b2c2e0a211109c9bc8074c942b8e245621eeae1254b10ec27f03a
MD5 64af769555cba53ba2af1e9c474e44b1
BLAKE2b-256 240e781ac63562f2be928e0a81837b7af895242d0b828be8c6c9a976c941fa3a

See more details on using hashes here.

Provenance

The following attestation bundles were made for benzene_grpc-0.1.0b1.tar.gz:

Publisher: release.yml on daniellepelley/benzene-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file benzene_grpc-0.1.0b1-py3-none-any.whl.

File metadata

  • Download URL: benzene_grpc-0.1.0b1-py3-none-any.whl
  • Upload date:
  • Size: 11.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for benzene_grpc-0.1.0b1-py3-none-any.whl
Algorithm Hash digest
SHA256 b551e12f3148f06ff0b88ac490d563a62c4fe41c381b5fbda0e0ec5abb70eee0
MD5 d9443ad1bb3996679e0cba9605fdb17e
BLAKE2b-256 83dc294ef3fb2cc88c29b52145ea2a55b752e1024edac1ffb6ea9db0efa79bbe

See more details on using hashes here.

Provenance

The following attestation bundles were made for benzene_grpc-0.1.0b1-py3-none-any.whl:

Publisher: release.yml on daniellepelley/benzene-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.0b1 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page