Replit River

raw JSON →
0.17.19 verified Mon Apr 27 auth: no python

Replit River is a Python toolkit for building reliable, bidirectional communication channels (RPC, streaming, etc.) between services, primarily used in the Replit environment. Current version 0.17.19 requires Python 3.12+ and is under active development with frequent releases.

pip install replit-river
error ModuleNotFoundError: No module named 'replit_river'
cause Package not installed or misspelled (e.g., 'replit-river' vs 'replit_river').
fix
Run pip install replit-river and use import replit_river (with underscore).
error ImportError: cannot import name 'RiverClient' from 'replit_river'
cause RiverClient is not exported from top-level package; must import from submodule.
fix
Use from replit_river.client import RiverClient.
error TypeError: __init__() got an unexpected keyword argument 'scheme'
cause API changed: `scheme` renamed to `transport` in version 0.17.0.
fix
Replace scheme='ws' with transport='ws'.
breaking Python 3.12 minimum: river requires Python >=3.12 (as of 0.17.x). Install may fail on older versions.
fix Upgrade Python to 3.12 or higher.
gotcha RiverClient and RiverServer are not top-level exports: importing from `replit_river` directly does not expose them. Must import from the respective submodules.
fix Use `from replit_river.client import RiverClient` and `from replit_river.server import RiverServer`.
breaking Transport parameter change: in early 0.16.x versions, the transport was specified via `scheme` argument. As of 0.17.x, it's `transport` with values 'ws' or 'http'.
fix Use `transport='ws'` instead of `scheme='ws'`.

Minimal client example: create RiverClient with WebSocket transport, call a remote procedure.

import asyncio
from replit_river.client import RiverClient

async def main():
    client = RiverClient(url='https://your-service.com', transport='ws')
    # Example: call a remote method
    result = await client.call('greet', {'name': 'World'})
    print(result)

asyncio.run(main())