blackbull-protobuf
Protobuf integration for the BlackBull ASGI framework's gRPC support: object-typed servicers, server reflection, health checking, and rich error details.
BlackBull's core gRPC layer (blackbull.grpc) is deliberately
protobuf-free — handlers exchange raw message bytes. This package adds
everything whose payloads are protobuf on the wire, as a separate
installable so the protobuf runtime never enters the framework's dependency
metadata and can version independently.
pip install 'blackbull[protobuf]' # or: pip install blackbull-protobuf
Object-typed handlers (add_servicer)
Write servicers against your generated *_pb2 messages. The adapter reflects
over the service descriptor, wires every implemented method onto a
GrpcServiceRegistry with the right streaming shape, and does
FromString/SerializeToString at the boundary:
from blackbull import BlackBull
from blackbull.grpc import GrpcServiceRegistry
from blackbull_protobuf import add_servicer
import helloworld_pb2
class Greeter: # duck-typed; a generated
async def SayHello(self, request, context): # <Service>Servicer
return helloworld_pb2.HelloReply( # base also works
message=f'Hello, {request.name}!')
async def SayManyHellos(self, request, context): # server-streaming
for i in range(3):
yield helloworld_pb2.HelloReply(message=f'{request.name} #{i}')
app = BlackBull()
registry = GrpcServiceRegistry()
add_servicer(registry, Greeter(), helloworld_pb2)
app.enable_grpc(registry)
app.run(port=8443, cert='cert.pem', key='key.pem')
All four RPC shapes are supported — unary, server-streaming (async
generator), client-streaming (request_iter of messages), and bidirectional.
The raw-bytes registry path is untouched; both styles coexist on one registry.
Server reflection
grpcurl / grpc_cli / Postman work without local .proto files:
from blackbull_protobuf import enable_reflection
enable_reflection(registry) # serves both grpc.reflection.v1 and v1alpha
Both reflection package versions are registered — v1alpha for older
clients and v1 for the newer ones that probe it first — so every client
generation resolves the endpoint on the first request.
$ grpcurl -insecure localhost:8443 list
$ grpcurl -insecure localhost:8443 describe helloworld.Greeter
$ grpcurl -insecure -d '{"name": "world"}' localhost:8443 helloworld.Greeter/SayHello
Health checking
The standard grpc.health.v1.Health service (Check + Watch) behind a
settable status map — the Kubernetes / load-balancer probe surface:
from blackbull_protobuf import enable_health, HealthService
health = enable_health(registry)
health.set('helloworld.Greeter', HealthService.SERVING)
health.set('helloworld.Greeter', HealthService.NOT_SERVING) # during drain
Rich error details
Attach structured google.rpc details that ride the
grpc-status-details-bin trailer, decoded on a grpcio client by
grpc_status.rpc_status.from_call:
from google.rpc import error_details_pb2
from blackbull.grpc import GrpcStatus
from blackbull_protobuf import abort_with_details
bad = error_details_pb2.BadRequest()
bad.field_violations.add(field='name', description='must not be empty')
abort_with_details(context, GrpcStatus.INVALID_ARGUMENT,
'name is required', [bad])
Design notes
- The vendored
grpc.health.v1/grpc.reflection.v1alpha/grpc.reflection.v1descriptors are embedded as serializedFileDescriptorProtos and loaded into a private descriptor pool — no generated code (so no protoc↔runtime version-lock), and no duplicate-file collision when the host application also importsgrpcio-health-checking/grpcio-reflectiongencode. - Reflection describes every service registered through this package and lists raw-bytes services too (they have no descriptors to describe).
- Requires BlackBull ≥ 0.51.0 (the error-path trailing-metadata contract that
grpc-status-details-binrides on).
Development
pip install -e '.[testing]'
python -m pytest tests/ -q
python scripts/gen_descriptors.py # after touching protos/
License: Apache-2.0.
Metadata
Release files for blackbull-protobuf 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| blackbull_protobuf-0.2.0.tar.gz | 25.7 kB | With provenance | Details for blackbull_protobuf-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| blackbull_protobuf-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for blackbull_protobuf-0.2.0-py3-none-any.whl |
Total release size: 47.6 kB
Release files / blackbull_protobuf-0.2.0.tar.gz
| Download URL | blackbull_protobuf-0.2.0.tar.gz |
|---|---|
| Size | 25.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e8e715e87c669c689956a014e57fa58c4b910753bb5984418b7cdd5ced77c186
|
|
BLAKE2b-256 checksum How to use checksums |
78779732af99dfd2f877b20a7b61b7ab13f06b220be58c58fcdf40cd2f02705e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 12, 2026.
Transparency logRelease files / blackbull_protobuf-0.2.0-py3-none-any.whl
| Download URL | blackbull_protobuf-0.2.0-py3-none-any.whl |
|---|---|
| Size | 21.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
44c08ebf2ce75a59e2123869c254732f3c42275ed11ee1ca2eaf2040ba30c3b7
|
|
BLAKE2b-256 checksum How to use checksums |
6b3f4f7951888456789c3b13bcb9c42963f5cea6cf941246ca68eb19fb84737b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 12, 2026.
Transparency logSecurity for blackbull-protobuf 0.2.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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for blackbull_protobuf-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 12, 2026.
Transparency logA 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.