Python subprocess manager for eRPC v0.0.62 — fault-tolerant EVM RPC proxy
Project description
erpc.py
Python subprocess manager for eRPC — the fault-tolerant EVM RPC proxy.
Like py-geth for Go-Ethereum, but for eRPC.
[!NOTE] This repository was built entirely by an AI agent (TARS) under the direction of a human engineer (Kieran Prasch). Every commit is co-authored. The architecture, priorities, and quality bar were set by a human; the implementation, tests, and documentation were produced by an AI — from first scaffold to 451 tests at 98% coverage. We believe this is how software will increasingly be built: human intent, machine execution, shared accountability.
Compatibility
| erpc.py | eRPC binary | Status |
|---|---|---|
0.1.x |
v0.0.62 |
✅ Current |
erpc.py pins a specific eRPC binary version (erpc.ERPC_VERSION). All config generation, tests, and CI target this version. Use install_erpc() to install the matching binary automatically.
from erpc import ERPC_VERSION, install_erpc
print(ERPC_VERSION) # "0.0.62"
install_erpc() # downloads the pinned version
Overview
erpc.py gives you full programmatic control over eRPC from Python — binary installation, YAML config generation, process lifecycle, health monitoring, and runtime metrics. Pure Python with only pyyaml as a runtime dependency.
from erpc import ERPCProcess
with ERPCProcess(upstreams={1: ["https://eth.llamarpc.com"]}) as erpc:
url = erpc.endpoint_url(1) # http://127.0.0.1:4000/py-erpc/evm/1
print(f"Proxying Ethereum mainnet at {url}")
Installation
pip install erpc-py
To install the eRPC binary:
erpc-py install --version 0.0.62
Or programmatically:
from erpc.install import install_erpc
install_erpc("0.0.62") # → /usr/local/bin/erpc
Quick Start
Minimal — just upstreams
from erpc import ERPCProcess
with ERPCProcess(upstreams={1: ["https://eth.llamarpc.com"]}) as erpc:
print(erpc.endpoint_url(1))
print(f"Healthy: {erpc.is_healthy}")
Full config
from erpc import ERPCConfig, ERPCProcess, CacheConfig
config = ERPCConfig(
project_id="my-project",
upstreams={
1: ["https://eth.llamarpc.com", "https://rpc.ankr.com/eth"],
137: ["https://polygon-rpc.com"],
},
server_port=4000,
metrics_port=4001,
log_level="info",
cache=CacheConfig(max_items=50_000),
)
with ERPCProcess(config=config) as erpc:
print(erpc.endpoint_url(1))
print(erpc.endpoint_url(137))
Features
🔧 Binary Management
Auto-detect or install eRPC binaries from GitHub releases with optional SHA256 verification.
from erpc.install import install_erpc
path = install_erpc("0.0.62", checksum="abc123...")
📝 Config Builder
Full-fidelity Python config that generates valid erpc.yaml — networks, upstreams, failsafe policies, rate limiters, auth, caching, database connectors, and more.
from erpc import ERPCConfig, DatabaseConfig, RedisConnector, AuthConfig, SecretAuth
config = ERPCConfig(
project_id="production",
upstreams={1: ["https://eth.llamarpc.com"]},
database=DatabaseConfig(
evm_json_rpc_cache=RedisConnector(addr="localhost:6379"),
),
auth=AuthConfig(
strategies=[SecretAuth(value="my-secret-key")],
),
)
config.write("erpc.yaml") # Write to file
print(config.to_yaml()) # Or get YAML string
Supported config sections:
- Networks with per-chain policies
- Upstream defaults and rich upstream configs
- 20+ provider presets (Alchemy, Infura, QuickNode, Ankr, etc.)
- Rate limiters and failsafe policies
- Auth strategies (Secret, JWT, SIWE, Network-based)
- Database connectors (Redis, PostgreSQL, DynamoDB, Memory)
- Cache policies with per-method TTLs
- Server config (CORS, timeouts) and metrics
🏥 Health & Metrics Client
Query eRPC's runtime health and Prometheus metrics — stdlib only, no requests needed.
from erpc.client import ERPCClient
client = ERPCClient("http://localhost:4000")
# Structured health check
status = client.health()
print(f"{status.version} — uptime: {status.uptime}s")
# Prometheus metrics as dict
metrics = client.metrics()
print(metrics.get("erpc_requests_total"))
📊 Health Monitoring
Track health state transitions over time.
from erpc import HealthMonitor, HealthEvent
monitor = HealthMonitor(url="http://localhost:4000", interval=30.0)
event = monitor.latest_event() # HealthEvent.HEALTHY / DOWN / etc.
🐳 Docker Integration
Run eRPC as a Docker container — no local binary needed. Uses the docker CLI, no Python Docker SDK required.
from erpc import ERPCConfig, DockerERPCProcess
config = ERPCConfig(upstreams={1: ["https://eth.llamarpc.com"]})
with DockerERPCProcess(config=config, name="my-erpc") as erpc:
print(erpc.endpoint_url(1))
print(erpc.logs(tail=20))
🖥️ CLI Tool
Manage eRPC from the command line:
erpc-py version # Show versions
erpc-py install --version 0.0.62 # Install binary
erpc-py health # Check health
erpc-py metrics # Show Prometheus metrics
erpc-py config generate \
--chains 1,137 \
--upstreams https://eth.llamarpc.com,https://polygon-rpc.com \
--output erpc.yaml # Generate config
erpc-py start --config erpc.yaml # Start eRPC
erpc-py stop # Stop eRPC
🛡️ Provider Presets
20+ built-in provider configurations for popular RPC services:
from erpc import AlchemyProvider, InfuraProvider, ERPCConfig
config = ERPCConfig(
upstreams={1: ["https://eth.llamarpc.com"]},
providers=[
AlchemyProvider(api_key="..."),
InfuraProvider(api_key="..."),
],
)
All supported providers
Alchemy · Ankr · BlastAPI · BlockPi · Chainstack · Conduit · DRPC · Dwellir · Envio · Etherspot · Infura · OnFinality · Pimlico · QuickNode · Repository · RouteMesh · Superchain · Tenderly · Thirdweb
API Overview
| Class | Description |
|---|---|
ERPCConfig |
Config builder — generates erpc.yaml from Python dataclasses |
ERPCProcess |
Subprocess lifecycle manager with context manager support |
DockerERPCProcess |
Docker container lifecycle manager |
ERPCClient |
Health and Prometheus metrics client (stdlib HTTP) |
HealthMonitor |
Health state tracking with event history |
install_erpc() |
Binary installer from GitHub releases |
CacheConfig |
Memory cache settings with per-method TTLs |
DatabaseConfig |
Database connector config (Redis, Postgres, DynamoDB, Memory) |
AuthConfig |
Auth strategies (Secret, JWT, SIWE, Network) |
ServerConfig |
Server settings (CORS, timeouts, host/port) |
Development
git clone https://github.com/tars-endurance/erpc.py.git
cd erpc.py
pip install -e ".[dev]"
# Run tests (319 tests, 96% coverage)
pytest
# Type checking
mypy erpc/
# Linting
ruff check .
ruff format --check .
License
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 erpc_py-0.1.0b3.tar.gz.
File metadata
- Download URL: erpc_py-0.1.0b3.tar.gz
- Upload date:
- Size: 46.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
10855d38f790d9dce79075be731bf8f6256de4e78ad1a9cf59bd18524e971ce9
|
|
| MD5 |
a718ec55a1b687429a9103e25dc2fb4b
|
|
| BLAKE2b-256 |
4dec31e0d17f01b2f231a608d6376866cdc09a6270e407996c712819a1b976b8
|
Provenance
The following attestation bundles were made for erpc_py-0.1.0b3.tar.gz:
Publisher:
publish.yml on tars-endurance/erpc.py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
erpc_py-0.1.0b3.tar.gz -
Subject digest:
10855d38f790d9dce79075be731bf8f6256de4e78ad1a9cf59bd18524e971ce9 - Sigstore transparency entry: 992392794
- Sigstore integration time:
-
Permalink:
tars-endurance/erpc.py@e8def6943f14b85e0abac34a47749c1fea98d0e6 -
Branch / Tag:
refs/tags/v0.1.0b3 - Owner: https://github.com/tars-endurance
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e8def6943f14b85e0abac34a47749c1fea98d0e6 -
Trigger Event:
release
-
Statement type:
File details
Details for the file erpc_py-0.1.0b3-py3-none-any.whl.
File metadata
- Download URL: erpc_py-0.1.0b3-py3-none-any.whl
- Upload date:
- Size: 51.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
33e6c319668acb76f3e11ca9c8f0ce1d17f00f3f3350c44a69f626e5d4595567
|
|
| MD5 |
5531be951b149e99872fe8ac6ea3ed26
|
|
| BLAKE2b-256 |
d73632b249b3b50c81e8a165b63c94b97b44c35913221b44c35ad6122370963c
|
Provenance
The following attestation bundles were made for erpc_py-0.1.0b3-py3-none-any.whl:
Publisher:
publish.yml on tars-endurance/erpc.py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
erpc_py-0.1.0b3-py3-none-any.whl -
Subject digest:
33e6c319668acb76f3e11ca9c8f0ce1d17f00f3f3350c44a69f626e5d4595567 - Sigstore transparency entry: 992392848
- Sigstore integration time:
-
Permalink:
tars-endurance/erpc.py@e8def6943f14b85e0abac34a47749c1fea98d0e6 -
Branch / Tag:
refs/tags/v0.1.0b3 - Owner: https://github.com/tars-endurance
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e8def6943f14b85e0abac34a47749c1fea98d0e6 -
Trigger Event:
release
-
Statement type: