hero

Bocadillo

A modern Python web framework filled with asynchronous salsa

Get Started →

🥪 Productive

A carefully chosen set of included batteries helps you solve common and more advanced problems.

🧞‍ 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 it:

pip install bocadillo

Build something:

# app.py
from bocadillo import App, Templates

app = App()
templates = Templates(app)

@app.route("/")
async def index(req, res):
    # Use a template from the ./templates directory
    res.html = await templates.render("index.html")

@app.route("/greet/{person}")
async def greet(req, res, person):
    res.media = {"message": f"Hi, {person}!"}

if __name__ == "__main__":
    app.run()

Launch:

python app.py

Make requests!

curl http://localhost:8000/greet/Bocadillo
{"message": "Hi, Bocadillo!"}

Hungry for more? Head to our Getting Started guide!