Skip to main content

Bocadillo

license pypi travis
python

Inspired by Responder, Bocadillo is a web framework that combines ideas from Falcon and Flask while leveraging modern Python async capabilities.

Under the hood, it uses the Starlette ASGI toolkit and the uvicorn 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 app
  • Flask-inspired decorator-based routing
  • Formatted string route patterns
  • Falcon-inspired passing of request and response
  • Send JSON responses using resp.media
  • Class-based views
  • Response headers
  • Status codes
  • HTTP error exceptions

TODO:

  • Template rendering
  • Static assets
  • Bocadillo CLI
  • Deployment guide

Contributing

See CONTRIBUTING for contribution guidelines.

Changelog

See CHANGELOG for a chronological log of changes to Bocadillo.

Metadata

Release files for bocadillo 0.2.1.post2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bocadillo 0.2.1.post2
File Size Uploaded
bocadillo-0.2.1.post2.tar.gz 2.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bocadillo 0.2.1.post2
File Interpreter ABI Platform
bocadillo-0.2.1.post2-py3-none-any.whl Python 3 none any Details

Total release size: 5.5 kB

Release files / bocadillo-0.2.1.post2.tar.gz

Download URL bocadillo-0.2.1.post2.tar.gz
Size 2.4 kB
Tags Source
SHA-256 checksum
How to use checksums
dba138297f945a5fa571f249ee6bf9f611dc3db7f67aab32dbd707d1bc659d28
BLAKE2b-256 checksum
How to use checksums
b7056501a3c47460019600271028b23cedef9ba15dada25a1b8df871a9c42442
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.2.1.post2-py3-none-any.whl

Download URL bocadillo-0.2.1.post2-py3-none-any.whl
Size 3.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d57312cfe493375451ea4751d34fd7c1b53e69386e8f15a34b14f17749672868
BLAKE2b-256 checksum
How to use checksums
b984f7d7964b25dc8858d0f4a2fdc87665ffab8e55f636cf700e1eee3705331b
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 history Release notifications | RSS feed

0.18.3

2 release files

0.17.0

2 release files

0.16.2

2 release files

0.15.1

2 release files

0.15.0

2 release files

0.14.2

2 release files

0.14.1

2 release files

0.14.0

2 release files

0.13.3

2 release files

0.13.2

2 release files

0.13.1

2 release files

0.13.0

2 release files

0.12.1

2 release files

0.12.0

2 release files

0.11.2

2 release files

0.11.1

2 release files

0.11.0

2 release files

0.10.2

2 release files

0.10.1

2 release files

0.10.0

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

This release

0.2.1.post2 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page