Extremely Stupid Simple, Blazing Fast, Get Out of your way immediately Microframework for building Python Web Applications.
Project description
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).
- Documentation Go To Docs
- PyPi https://pypi.org/project/heaven
- Source Code Github
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
orcontrollers/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')
# we'll get to this in a minute
dbconn = req.app.peek('dbconnection')
results = await dbconn.execute('select * from patients where id = 1000')
# req, res, ctx are available in your jinja templates
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):
# write code to connect to your database here
pool = DatabasePool('dsn://here')
# this will be available in all request handlers as request.app._.dbconn or req.app.peek('dbconn')
app.keep('dbconn', pool)
- Create your heaven application and connect your request handler e.g. in
src/example.py
from heaven import App # also available as Router, Application
router = Router()
# you can persist things like db connections etc at app startup
router.ON(STARTUP, 'middlewares.connections.updatabase')
# note that you did not need to import your request handler, just giving heaven
# the path to your handler as a string is enough
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
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
File details
Details for the file heaven-0.5.1.tar.gz
.
File metadata
- Download URL: heaven-0.5.1.tar.gz
- Upload date:
- Size: 18.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.5 CPython/3.12.3 Linux/6.8.0-51-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
3342b6611bdc1e74c4086622a7f3e95b44f9a3f305cbdcd8247cb0e61975a244
|
|
MD5 |
da2099a1a809d27b1fa91dc369e4d120
|
|
BLAKE2b-256 |
5d2812867e0baa9bce42ccc1eeffe16d37e8d31204529959ec4851e998f132e2
|
File details
Details for the file heaven-0.5.1-py3-none-any.whl
.
File metadata
- Download URL: heaven-0.5.1-py3-none-any.whl
- Upload date:
- Size: 20.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.5 CPython/3.12.3 Linux/6.8.0-51-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
a87645466fcbc07fe642511e92f4c427c3a747c6c452ef26a6ceafe11e5791d8
|
|
MD5 |
da614bbb675dd5fef7d1a7c223dae8b0
|
|
BLAKE2b-256 |
520b7c164d95d862ef1273274a79f33cbe81a6193f4029164ecbd1a808eb306e
|