Registry / http-networking / sonora

sonora

JSON →
library0.2.3pypypiunverified

A WSGI and ASGI compatible gRPC-web implementation. Version 0.2.3 supports Python >=3.7,<4.0. Provides middleware for integrating gRPC-web clients with Python web frameworks like Flask (WSGI) or Starlette (ASGI).

pip install sonora
INSTALL
IMPORT
SIG · SONORA
S
sonora
http-networkingpythonv0.2.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

SonoraWSGIMiddleware
from sonora.wsgi import SonoraWSGIMiddleware
from sonora.wsgi import SonoraWSGIMiddleware

Basic WSGI integration with Flask.

from flask import Flask from sonora.wsgi import SonoraWSGIMiddleware app = Flask(__name__) # Placeholder gRPC handler (replace with actual implementation) def my_grpc_handler(request): return {} sonora_app = SonoraWSGIMiddleware(app, handler=my_grpc_handler) if __name__ == '__main__': from wsgiref.simple_server import make_server server = make_server('localhost', 5000, sonora_app) server.serve_forever()
Debug
Known issues
gotchaSonora requires an actual gRPC handler; it does not auto-generate stubs. You must define a handler that processes gRPC-web requests.
fix
Implement a callable handler that matches the gRPC service definition.
affects: all
gotchaSonora does not support streaming gRPC (both client and server streaming). Only unary calls are supported.
fix
Use other libraries like grpcio-web or grpc-gateway for streaming.
affects: <=0.2.3
deprecatedSonora's API may change in future versions; the project is experimental and not widely maintained.
fix
Monitor the repository for updates or consider alternatives like grpclib or grpc-web.
affects: all
gotchaWhen using ASGI, SonoraASGIMiddleware expects a handler that returns an HTTP response; it does not integrate with Starlette's request/response cycle directly.
fix
Ensure the handler returns a dict with status, headers, and body.
affects: all
Upgrade
Version history
0.2.3latest on PyPI · released Aug 23, 2023
Audit
Dependencies

No dependency data recorded yet.

Agent activity
14 hits · last 30 days
node
12
OpenAI (training)
1
Resources
sonora — pip install sonora · libregistry