A modern Python web framework filled with asynchronous salsa.
Project description
Documentation · Source code · CLI
Migrating from v0.13.x? Read the v0.14 release notes.
Bocadillo is a Python async web framework that makes server-side async web apps fun to build and accessible to everyone.
It is designed to be:
-
Productive: a carefully chosen set of included batteries helps you solve common and more advanced problems — request routing, app configuration, static files, data validation, and more!
-
Real-time capable: embrace asynchronous programming and the baked-in WebSocket and SSE support to build real-time, highly-concurrent systems.
-
Flexible: inject resources into web views using providers, an explicit, modular and easy-to-use mechanism inspired by pytest fixtures.
-
Performant: squeeze the juice out of Starlette and uvicorn, the lightning-fast ASGI toolkit and web server.
-
Empowering: use tailored testing and command line tools to build delicious, high-quality applications.
-
Transparent: every single feature is documented front to back and has optimal editor support thanks to a 100% type-annotated code base.
Quick start
- Install Bocadillo and the Bocadillo CLI:
pip install bocadillo bocadillo-cli
- Generate a project and
cd
into it:
bocadillo create hello
cd hello/
- Edit the application script:
# hello/app.py
from bocadillo import App
app = App()
@app.route("/")
async def index(req, res):
res.text = "Hello, world!"
- Start a uvicorn server (hot reload enabled!):
uvicorn hello.asgi:app --reload
- Say hello!
$ curl http://localhost:8000
Hello, world!
- Edit
app.py
to send "Hello, Bocadillo!" instead, then hit save. Uvicorn will pick up the changes and restart the application. Try it out again:
$ curl http://localhost:8000
Hello, Bocadillo!
Tastes good! 🥪
Hungry for more? Head to the docs.
Changelog
We record changes to Bocadillo in the changelog. In particular, check out the Unreleased section to see what's coming in the next release.
Contributing
Found a bug? A typo? Want to help build a new feature? We'd love to see your contributions! There are also many ways to contribute that don't include code: helping with issues, laying out new ideas, improving docs, etc.
Check out our Contributing guide to get started.
By the way, here's our Contributor Hall of Fame. 👨💻👩💻
Credits
Logo designed by Florimond Manca. Sandwich icon designed by macrovector.
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
Hashes for bocadillo-0.15.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 34bbb14c7995900eff88cb3a4a3e89da5e68a57577b896a45679a4778447cbd1 |
|
MD5 | b85cf456acafc5afa0c85ddeb316f42a |
|
BLAKE2b-256 | 90f830704305bcc1d09c42693a8222a3ba65ab40d315e9cc24ff9103afdf450b |