An easy to use rpc framework for enabling fast inter-process, inter-container, or inter-host communication
Easily share functions between hosts, processes, containers without the complexity of defining non-native python types or proxy modules.
Documentation
Key Features
- No predefined proxy functions at the remote endpoints
- Easily group and share functons among hosts / processes using Namespaces / Namespace Groups
- Proxy functions parameters are validated as if defined locally.
- Optional: pre-flight encyrption
- No strict RPC message structure / size limit
- Flexible parameter types within pickable constraint
Quick Start
$ uv init --python ">=3.11"
$ uv add easyrpc
Basic Usage:
# server.py
from fastapi import FastAPI
from easyrpc.server import EasyRpcServer
server = FastAPI()
ws_server_a = EasyRpcServer(server, '/ws/server_a', server_secret='abcd1234')
@ws_server_a.origin(namespace='public')
def good_func_a(a, b, c):
print(f"good_func_a {a} {b} {c}")
return {"good_func_a": [a, b, c]}
# client.py
import asyncio
from easyrpc.proxy import EasyRpcProxy
async def main():
proxy = await EasyRpcProxy.create(
'0.0.0.0',
8090,
'/ws/server_a',
server_secret='abcd1234',
'namespace='public'
)
good_func_a = proxy['good_func_a']
result = await good_func_a(1, 5, 7)
print(result)
asyncio.run(main())
Recipes
See other usage examples in Recipes
Supported Functions Features
- async def & def
- async generators & generators
- *args, **kwargs
- positional & default parmeters
- TODO - type annotations
Common Use Cases
- State sharing among forked workers
- Shared Database connections / cache
- Shared Queues
- Worker Pooling - Easy centralization for workers and distribution of work.
- Function Chaining
Metadata
Release files for easyrpc 0.251
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| easyrpc-0.251-py3-none-any.whl | Python 3 | none | any | Details |
Release files / easyrpc-0.251-py3-none-any.whl
| Download URL | easyrpc-0.251-py3-none-any.whl |
|---|---|
| Size | 22.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ac1ec9f493cc9ea655f8a78b458a7f9543e7f9f7fd5395926874353a4b61c988
|
|
BLAKE2b-256 checksum How to use checksums |
9b470e3590106ed3fbb6bee99d9d839e6553da287e0fa8b2146b38156568f4cc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|