Skip to main content

A modern Python web framework filled with asynchronous salsa.

Project description

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.

Project details


Download files

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

Source Distribution

bocadillo-0.2.1.post3.tar.gz (2.4 kB view details)

Uploaded Source

Built Distribution

bocadillo-0.2.1.post3-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

Details for the file bocadillo-0.2.1.post3.tar.gz.

File metadata

  • Download URL: bocadillo-0.2.1.post3.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for bocadillo-0.2.1.post3.tar.gz
Algorithm Hash digest
SHA256 834598c52a8c6c780fc061f33a62b1a184c285c9342e3d9b3cdf05aa83acc1c3
MD5 1b6eaf24146fbb7d0c9de43dbc6e8fce
BLAKE2b-256 0d69e685e56184c28447e35311080ff6eae8e5a5864696e7b75eee6cbfde1896

See more details on using hashes here.

File details

Details for the file bocadillo-0.2.1.post3-py3-none-any.whl.

File metadata

  • Download URL: bocadillo-0.2.1.post3-py3-none-any.whl
  • Upload date:
  • Size: 3.2 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for bocadillo-0.2.1.post3-py3-none-any.whl
Algorithm Hash digest
SHA256 b9d5eb943330050a722b23805f0ddb453b60f2c482fcf4cb4e7883ab2284b80a
MD5 3cfbb51ac7cb53c91975f581ea317a89
BLAKE2b-256 8011ad272375cb2e80e26e38253c4d9246dee892e21b5452507d338df2d5e744

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page