connectrpc

raw JSON →
0.10.0 verified Sat May 09 auth: no python

Server and client runtime library for Connect RPC. Current version: 0.10.0. Requires Python >=3.10. Released on PyPI as connectrpc since v0.9.0 (previously connect-python). Monthly releases.

pip install connectrpc
error ModuleNotFoundError: No module named 'connectrpc'
cause Package not installed or installed under old name 'connect-python'.
fix
pip install connectrpc
error TypeError: create_connect_client() got an unexpected keyword argument 'proto_json'
cause proto_json=True removed in v0.10.0.
fix
Use codec=proto_json_codec() instead.
error AttributeError: module 'connectrpc' has no attribute 'server'
cause Incorrect import path. Package structure uses submodules like connectrpc.server.
fix
Use 'from connectrpc.server import create_connect_server'
breaking PyPI package renamed from 'connect-python' to 'connectrpc' in v0.9.0. Update your dependencies to 'connectrpc'.
fix pip uninstall connect-python && pip install connectrpc
breaking proto_json=True removed in v0.10.0. Use codec=proto_json_codec() instead.
fix from connectrpc.codec import proto_json_codec; client = create_connect_client('...', codec=proto_json_codec())
gotcha Default transport changed from httpx to pyqwest (v0.8.0+). For custom HTTP settings, use transport parameter.
fix from connectrpc.transport import PyqwestTransport; create_connect_client('...', transport=PyqwestTransport(...))
deprecated The 'connect-python' package on PyPI is deprecated. All future releases are under 'connectrpc'.
fix See rename warning.

Minimal JSON client calling a Connect RPC service.

import asyncio
from connectrpc.client import create_connect_client
from connectrpc.codec import proto_json_codec

async def main():
    client = create_connect_client(
        "http://localhost:8080",
        codec=proto_json_codec(),
    )
    request = {"name": "World"}
    response = await client.call("greet.GreetService/Greet", request)
    print(response)

asyncio.run(main())