Skip to main content

A modern, tasty Python web framework filled with salsa. ๐ŸŒฎ

Project description

Bocadillo

license pypi travis
python

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
bocadillo-0.1.0-py3-none-any.whl (3.0 kB) Copy SHA256 hash SHA256 Wheel py3
bocadillo-0.1.0.tar.gz (2.3 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page