the main goal of this framework is to make expandable system for creating api with minimal dependencies and overhead
Key features:
- Easy to use: Syntax was inspired by your favourite framework
- Fast: contains only 1 dependency with minimal overhead see benchmarks
- Async Only: Supports only work with async requests handling
- Validation: Built-in support of MsgSpec providing first-class Validation Speed
- Minimalistic: Framework contains Minimal functional to build API
- OpenAPI: Documentate your API (QoL changes WIP)
- msgspec: A fast serialization and validation library
pip install rapis
pip install granian # install any rsgi compatible web-server
# or simply
pip install rapis[standard] # includes granian in requirements# main.py
from rapis import AppRouter, WebApp
router = AppRouter()
@router.get("/")
async def root() -> dict:
return {}
app = WebApp()
app.include_router(router)granian main:app# routes.py
from msgspec import Struct
from rapis import AppRouter, Query
router = AppRouter()
class Item(Struct):
name: str
@router.get("/queries_with_struct")
async def fetch_item(item: Query[Item]): # no default means required and will expect to receive all fields in query params
return Item(name="query") # automatically parses to {"name": "query"}
@router.post("/echo") # also put, patch
async def fetch_item(item: Item): # will try to read and validate all fields from body
return item# main.py
from rapis import WebApp
from routes import router
app = WebApp()
app.include_router(router)More examples
Performance benchmarks
- MAKE FRAMEWORK EASY TO EXTEND, EASY TO OVERRIDE (DIP, and other things included)
- coverage (atleast 80%)
- Test Client
- Docs
- life cycle
- Problem: how to authenticate users?
- Problem: how to send files? (receive files: like query, send files: ??)
- Problem: how to work with cookies? (get cookies: like query, send cookies: ??)
- https://jcristharif.com/msgspec/perf-tips.html (reduce latency more)
- Exception handling
- Built-in exception handlers (validation, json parsing)
- Benchmarks section
- better Query params handle
- change routing from linear to something else (hash maps for static paths, ?? for dynamic paths)
- path patterns logic
- review Middleware logic
- typing support in TY
- some examples