| Crates.io | pytarpc |
| lib.rs | pytarpc |
| version | 0.2.0 |
| created_at | 2025-08-30 17:40:36.108577+00 |
| updated_at | 2025-11-15 15:46:16.431975+00 |
| description | Enabling python-rust API communication over tarpc |
| homepage | https://github.com/DGPardo/pytarpc |
| repository | https://github.com/DGPardo/pytarpc |
| max_upload_size | |
| id | 1817796 |
| size | 42,490 |
This repository provides a procedural macro for generating Python clients from Rust tarpc servers automatically. Using PyO3 and pyo3-asyncio, it allows seamless Python integration with Rust RPC endpoints while supporting all serde-serializable data types.
In the future, this project aims to be able to generate pyi files in order to be able to provide type information and signatures of the generated packages for the python clients
pyo3-asyncioserde-serializable data types, not just basic primitives# Navigate to your Rust project folder
maturin develop -r
#[tarpc_python_client]
#[tarpc::service]
pub trait RpcAPI {
async fn hellow(name: String) -> i32;
}
from rpc_model import PyRpcAPIClient
import asyncio
async def main():
stub = await PyRpcAPIClient.connect("127.0.0.1:5000")
response = await stub.hello("Diego")
print(response)
asyncio.run(main())
The example/ folder contains a minimal working example demonstrating:
tarpc-server/)rpc-model/)client.py)Run the example by following the steps in example/README.md.
pyo3-asyncio to handle async calls nativelySerialize/Deserialize works seamlesslymy-project/
│
├── macros/ # Procedural macro code
├── rpc-model/ # Rust models compiled as Python modules
├── tarpc-server/ # Rust tarpc server implementations
├── example/ # Example demonstrating Python client usage
└── client/ # Optional standalone Python clients
Contributions, bug reports, and feature requests are welcome! Please open an issue or submit a pull request.
This project is licensed under the MIT License.