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
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
File details
Details for the file replit_river-0.1.12.tar.gz
.
File metadata
- Download URL: replit_river-0.1.12.tar.gz
- Upload date:
- Size: 27.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.11.5 Darwin/22.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | de8f3c10b8eea34be216a16a46d50b85eaf55e1d09755b68dd526feca83e79df |
|
MD5 | 9ea410efa98b69b1b2dc8b46f4d88ca3 |
|
BLAKE2b-256 | a41b429773f5795bd6b97912af67a8bf9a8d9b6d4a5adfb80bb175f32d39d940 |
File details
Details for the file replit_river-0.1.12-py3-none-any.whl
.
File metadata
- Download URL: replit_river-0.1.12-py3-none-any.whl
- Upload date:
- Size: 35.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.11.5 Darwin/22.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 058a349381dadf7be3883c70d48ca259b0ade30b388a9a467207c9ae8ac3775b |
|
MD5 | 28b5c55838d5dbca77dff5362b5e67bc |
|
BLAKE2b-256 | 5739bb5c2478c9d7a30d7b23dc454bb4db7733c97ff216079b6385d3fb25f27b |