Replit river toolkit for Python
Project description
River
Machinery for compatibility with https://github.com/replit/river, the protocol behind the Workspace ↔ pid2 WebSocket (and in general, the protocol behind the Workspace ↔ * WebSocket).
Since the pid2 services are declared in TypeScript using TypeBox in the main repl-it-web repository, and it would be terrible for everyone involved to force folks to follow this paradigm of declaring their services, types, and interfaces in a foreign repository, any other River servers will use gRPC for their protocol definition and implementation. The @replit/river-codegen
package can be used to compile the gRPC .proto
files into a River-compatible TypeBox declaration that can be then packaged into an npm package that can be imported by the Workspace and consumed ergonomically.
This includes the necessary machinery to act as a client or server for River:
- As a River server, create a WebSocket server and the gRPC -> Python River codegen (similar to the protoc flow that generates the Python bindings).
- As a River client, create a WebSocket client and the JSON Schema -> Python River codegen.
python -m river.codegen client --output pkgs/river/river/schema.py --client-name Pid2Client pkgs/river/schema.json
- If we need to create the client-side of a Python gRPC River server, we also need to generate the JSON schema from the .proto file, with this command:
python -m river.codegen server-schema --output pkgs/river/river/schema.py pkgs/river/tests/client/proto/test.proto && cat ./test_schema.json
Publishing
Make sure you have pypi token setup, easiest way is to set env var POETRY_PYPI_TOKEN_PYPI
.
- update version either manually or via
poetry version
poetry build
poetry publish
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for replit_river-0.2.14-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b0f365d7db408e33715d24465ef4e8c6e00d2f6483c3d4a966bd871d501a0a5 |
|
MD5 | 2754430680d87eaa1d3735a16f7b06a7 |
|
BLAKE2b-256 | c83df254f895c413e15825241d5e13f5aca4380e92b9e5baf22bb04560023ce5 |