wire_rpc
Typed asyncio JSON-RPC 2.0 for Python, with pluggable transports, codecs and authentication.
- Typed handlers. Write plain
asyncfunctions with type hints; params are validated before your code runs and results are checked on the way out. - Seven transports, one API. TCP, WebSocket, HTTP, stdio and in-process threads, with one-client and many-client servers. Swap transports without touching handlers.
- Three codecs. JSON (msgspec), Pydantic, and MessagePack.
- Full JSON-RPC 2.0. Calls, notifications and batches, plus server push
(
broadcast) on TCP and WebSocket. - Authentication built in. Bearer tokens, JWTs, API keys, cookie login, TCP token and HMAC handshakes, and mutual TLS, with sessions in memory, SQLite, Redis or PostgreSQL.
- Safe by default. Every message, queue and wait is bounded; errors never leak exception text; credentials are re-checked before every call and never sent without TLS.
- Observable. An access log, a metrics hook and counters.
Python 3.12+. Documentation · Changelog · PyPI
Install
pip install wire-rpc
# extras: password, jwt, redis, postgres
pip install "wire-rpc[jwt,redis]"
Quick start
A server:
import msgspec
from wire_rpc import App
from wire_rpc.transports.tcp import TcpServerTransport
class AddParams(msgspec.Struct):
a: int
b: int
app = App(TcpServerTransport(host="127.0.0.1", port=9000))
@app.method("add")
async def add(params: AddParams, ctx) -> int:
return params.a + params.b
if __name__ == "__main__":
app.run()
A client:
import asyncio
from wire_rpc import Client
from wire_rpc.transports.tcp import TcpClientTransport
async def main():
async with Client(TcpClientTransport(host="127.0.0.1", port=9000)) as client:
print(await client.call("add", int, {"a": 2, "b": 3})) # 5
asyncio.run(main())
Batches and notifications:
from wire_rpc.client import BatchCall, BatchNotification
results = await client.batch([
BatchCall("add", int, {"a": 1, "b": 2}),
BatchNotification("audit.log", {"event": "added"}),
])
Transports
| Transport | Server | Client | Best for |
|---|---|---|---|
| TCP | TcpServerTransport, TcpMulticastServerTransport |
TcpClientTransport |
Service-to-service; fastest |
| WebSocket | WsServerTransport, MulticastWsServerTransport |
WsClientTransport |
Browsers, server push |
| HTTP | HttpServerTransport |
HttpClientTransport |
Proxies, load balancers, curl |
| stdio | StdIoServerTransport |
StdIoTransport |
Plugins and worker processes |
| Threads | ThreadTransport.pair() |
the other end | In-process, and tests |
Documentation
- Getting started
- Handlers · Routers and middleware · Apps and lifecycle · Errors
- The client
- Transports · Codecs
- Authentication · Security model
- Limits · Observability · Deployment · Benchmarks
- Protocol support · Configuration reference · Testing your service
Versioning and security
wire_rpc follows semantic versioning; while it's 0.x, minor releases may break
compatibility, and every breaking change is listed in the
changelog with
what to do. Report vulnerabilities privately as described in
SECURITY.md.
Contributing
Development setup, the test suite, design notes and the release process are in dev_notes/.
License
MIT
Metadata
Release files for wire-rpc 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| wire_rpc-0.3.0.tar.gz | 311.6 kB | Without provenance | Details for wire_rpc-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| wire_rpc-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for wire_rpc-0.3.0-py3-none-any.whl |
Total release size: 404.8 kB
Release files / wire_rpc-0.3.0.tar.gz
| Download URL | wire_rpc-0.3.0.tar.gz |
|---|---|
| Size | 311.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
efbd0ccedcfca8f6974a0b18123f254c5082ece332d6e4c4867911338bcec1a8
|
|
BLAKE2b-256 checksum How to use checksums |
650f71731e0a0e5b4950969298c947924e7e0adcbc9dd6aba2b8f891271fe557
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.3
|
Release files / wire_rpc-0.3.0-py3-none-any.whl
| Download URL | wire_rpc-0.3.0-py3-none-any.whl |
|---|---|
| Size | 93.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
51da0c3a8f11bef88c5f302fafaa08034cd94d6b33ecaf6da18bf8c0176a3bb3
|
|
BLAKE2b-256 checksum How to use checksums |
8be05cb288c440c44d9a2f45b5ca7dcf6638195fa0a54e0d07c90f8565a2acbb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.3
|
Security for wire-rpc 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.