Heaven : 
Heaven is a very very small, extremely tiny, and insanely fast ASGI web application framework. It was designed to facilitate productivity by allowing for complete mastery in 10 minutes or less.
Heaven is a very light layer around ASGI with support for application mounting and is perhaps the simplest and one of the fastest python web frameworks (biased opinion of course).
Quickstart
- Install with pip
$ pip install heaven
- create a function to handle your http requests in a file of your choosing i.e.
patients.py
or controllers/patients/records.py
from heaven import Request, Response, Context
async def get_record_by_id(req: Request, res: Response, ctx: Context):
id = req.params.get('id')
dbconn = req.app.peek('dbconnection')
results = await dbconn.execute('select * from patients where id = 1000')
ctx.keep('results', results)
await res.render('patients.html')
- Optional : You can create functions to be initialised at app startup i.e. in
middlewares/database.py
from heaven import App
async def updatabase(app: App):
pool = DatabasePool('dsn://here')
app.keep('dbconn', pool)
- Create your heaven application and connect your request handler e.g. in
src/example.py
from heaven import App
router = Router()
router.ON(STARTUP, 'middlewares.connections.updatabase')
router.GET('/v1/patients/:id', 'controllers.patients.records.get_record_by_id')
- You can run with uvicorn, gunicorn or any other asgi HTTP, HTTP2, and web socket protocol server of your choice.
$ uvicorn app:example --reload
* Running on http://127.0.0.1:8000
Contributing
For guidance on how to make contributions to Routerling, see the Contribution Guidelines