A modern async JSON-RPC framework built on Starlette. Where determination rises from simplicity.
Project description
wilrise
Wilrise is a server-side JSON-RPC framework built on Starlette.
It targets teams that want RPC semantics (method-oriented API, batch support) while staying inside the ASGI ecosystem. It supports mounting under an existing Starlette/FastAPI app, reusing middleware, dependency injection, and Pydantic validation.
This document assumes you are already familiar with JSON-RPC 2.0. The framework implements the server side only; use any JSON-RPC 2.0–compliant client to call your methods.
Install
# With uv (recommended)
uv add wilrise
# Or pip
pip install wilrise
For Pydantic validation and clear Invalid params (-32602) error codes on type mismatches, install the optional extra: uv add "wilrise[pydantic]".
Quick start
1. Write a minimal service (e.g. main.py):
from wilrise import Wilrise
app = Wilrise()
@app.method
def add(a: int, b: int) -> int:
return a + b
if __name__ == "__main__":
app.run(host="127.0.0.1", port=8000)
2. Run the server:
uv run python main.py
3. Send a request:
curl -X POST http://127.0.0.1:8000/ \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0", "method":"add", "params":{"a":1, "b":2}, "id":1}'
Response: {"jsonrpc":"2.0","result":3,"id":1}
Learning by Examples
To learn the framework quickly, we highly recommend checking out the examples/ directory. It contains step-by-step runnable tutorials:
- 01_minimal.py — The absolute basics.
- 02_routing.py — Grouping methods with
Routerand prefixes. - 03_dependencies.py — Dependency injection (
Use). - 04_parameters.py — Advanced parameters (
Paramalias/default). - auth_crud/ — A full production-like app with SQLAlchemy, JWT auth, and CRUD.
Run the examples from the examples folder:
cd examples
uv sync
uv run python 01_minimal.py
See examples/README.md for more details.
Documentation Index
For advanced topics, production readiness, and deep-dives, see the specific guides in the docs/ folder:
- 📖 Architecture & Lifecycle: How a request is processed from HTTP to JSON-RPC and back. Read architecture.md
- ⚙️ Configuration: Environment variables, payload limits, and debugging. Read configuration.md
- 🚨 Errors & Exceptions: Protocol vs App errors,
RpcError, and mapping third-party exceptions. Read errors.md - 📊 Observability: Logging requests, Trace IDs, and integrating with OpenTelemetry / Loguru. Read observability.md
- 🛠 Troubleshooting & Runbook: Handling common issues like 413, -32600, or -32603. Read runbook.md
- 🔄 FastAPI Migration: Coming from FastAPI? See the exact feature mapping. Read migration-from-fastapi.md
- 🚀 Production Checklist: What to check before going live. Read PRODUCTION_READINESS_CHECKLIST.md
Development and Contributing
Bugs and feature requests are welcome. See CONTRIBUTING (中文) for code style, formatting, and PR guidelines.
# Setup dev environment
uv sync --group dev
# Format and lint
uv run ruff format . && uv run ruff check .
# Type check
uv run pyright
中文说明见 README.zh-CN.md.
Project details
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 wilrise-0.3.1.tar.gz.
File metadata
- Download URL: wilrise-0.3.1.tar.gz
- Upload date:
- Size: 15.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
47914ce83bb0bb402f8b113822538e9635c9149a47e317e46465d45f77e20631
|
|
| MD5 |
7af2267514046fb0e163e1d12bd5ab2e
|
|
| BLAKE2b-256 |
a8af428a23916b5bb5004fa9686bd368e62e914795af522fb33ecea696a219f3
|
File details
Details for the file wilrise-0.3.1-py3-none-any.whl.
File metadata
- Download URL: wilrise-0.3.1-py3-none-any.whl
- Upload date:
- Size: 18.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5230fd870d99f944217ff4d0f7c4367d6cb30b40dc1c2af7a209c8fe128caf7c
|
|
| MD5 |
011f3192947e66a119e2209f737a5bf8
|
|
| BLAKE2b-256 |
02c908a3e7a63090cbed55ebcc6a823a6fc5b0e39eebb0624d3df3c8647323d0
|