Peer-to-peer remote object proxies over multiplexed streams
Project description
Proxyables (Python)
A high-performance, peer-to-peer RPC library that makes remote objects feel local. Built on top of Yamux multiplexing and Python's __getattr__ magic, it enables seamless bi-directional interaction between processes with support for callbacks, distributed garbage collection, and transparent async proxying.
Features
- Peer-to-Peer Architecture: No strict client/server distinction — both sides can import and export objects, enabling true bi-directional communication.
- "Local-Feeling" API: Intercepts property access, method calls, and item access using
__getattr__and__getitem__, making remote objects behave like local ones. - Distributed Garbage Collection: Automatically manages remote object lifecycles using
weakrefand a reference counting protocol. - Bi-Directional Callbacks: Pass functions and objects as arguments — they are automatically registered and hydrated as proxies on the other side.
- Instruction Batching: Chains of property accesses and method calls are accumulated and sent as a single
EXECUTEinstruction for efficiency. - Stream Multiplexing: Uses Yamux to multiplex concurrent operations over a single connection.
Installation
pip install stateforward.proxyables
Usage
Basic Example
Server (Exporting an object):
from proxyables import Proxyable
class API:
def echo(self, msg: str) -> str:
return f"echo {msg}"
def compute(self, a: int, b: int) -> int:
return a + b
# stream is any asyncio duplex stream
exported = await Proxyable.Export(API(), stream)
Client (Importing the object):
from proxyables import Proxyable
proxy = await Proxyable.ImportFrom(stream)
# Usage - feels completely local!
result = await proxy.echo("hello") # "echo hello"
result = await proxy.compute(10, 20) # 30
Architecture
- Proxy Layer:
ProxyCursorwraps remote objects, accumulating instructions on property access and method calls. - Instruction Protocol: Operations (get, apply, etc.) are serialized into
ProxyInstructionmessages using MessagePack. - Transport: Uses Yamux to multiplex concurrent operations over a single connection (TCP, Unix socket, stdio, etc.).
- Reference Management: An
ObjectRegistrytracks local objects passed by reference with automatic cleanup viaweakref.
License
MIT
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file stateforward_proxyables-0.1.0.tar.gz.
File metadata
- Download URL: stateforward_proxyables-0.1.0.tar.gz
- Upload date:
- Size: 15.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4bb61c520826acd1bf5fde67287bc3372b810863ad4e64e991b36a94ba23daaa
|
|
| MD5 |
2cf1ada97be482541be092e1dc474e26
|
|
| BLAKE2b-256 |
0c5c7e93f30920b140d477fdf2551ab73c960cfcba7d3ca727ff3f2e8036f41a
|
File details
Details for the file stateforward_proxyables-0.1.0-py3-none-any.whl.
File metadata
- Download URL: stateforward_proxyables-0.1.0-py3-none-any.whl
- Upload date:
- Size: 18.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b24f79c262779097f5e5da2e2a092749998c1f4157ad7974130fa8812e4eb683
|
|
| MD5 |
4af6eeaa7f725350acd135d2db029aca
|
|
| BLAKE2b-256 |
497c867335790ac88fbaef4b450dc450b48c6749708a25861fc1c07c812a7de7
|