Bocadillo
Inspired by Responder, Bocadillo is a take on building a web framework taking the best parts of Falcon and Flask.
Under the hood, it uses Starlette as an ASGI toolkit and uvicorn as an ASGI server.
Quick start
Write your first app:
# app.py
import bocadillo
api = bocadillo.API()
@api.route('/add/{x:d}/{y:d}')
async def greet(req, resp, x: int, y: int):
resp.media = {'result': x + y}
if __name__ == '__main__':
api.run()
Run it:
python app.py
# or directly using uvicorn:
uvicorn app:api
INFO: Started server process [81910]
INFO: Waiting for application startup.
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
Make some requests!
curl http://localhost:8000/add/3/5
{"result": 5}
🌯💥
Install
Bocadillo is available on PyPI:
pip install bocadillo
Features
- ASGI-compatible
- Flask-inspired decorator-based routing
- Formatted string route patterns
- Falcon-inspired passing of request and response
- Send JSON using
resp.media - Class-based views
- Response headers
TODO:
- Status codes
- HTTP error exceptions
- Template rendering
- Static assets
- Bocadillo CLI
Contributing
See CONTRIBUTING for contribution guidelines.
Metadata
Release files for bocadillo 0.1.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 | |
|---|---|---|---|
| bocadillo-0.1.0.tar.gz | 2.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bocadillo-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 5.3 kB
Release files / bocadillo-0.1.0.tar.gz
| Download URL | bocadillo-0.1.0.tar.gz |
|---|---|
| Size | 2.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8315fa84295d1ec31ccc31ee41ffcd33d7d47a24b640a9a1685ab87b091f3d0e
|
|
BLAKE2b-256 checksum How to use checksums |
62cbdd6aaa5a23a7727cac6031a6dcddf315d1a83cb2cd75177e9eec32ca4f20
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1
|
Release files / bocadillo-0.1.0-py3-none-any.whl
| Download URL | bocadillo-0.1.0-py3-none-any.whl |
|---|---|
| Size | 3.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
256b1e33c18193e93de0bb810b09bde1c8e4bd8d439c4b12f21064e6003211c0
|
|
BLAKE2b-256 checksum How to use checksums |
5cecd4c0602d2f6bc0df4126f87a48090dc64ce2f5d20a027eb049d18ae13139
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1
|