Skip to main content

Microframework

Project description

Chalice is a microframework for writing serverless apps in python. It allows you to quickly create and deploy applications that use AWS Lambda. It provides:

  • A command line tool for creating, deploying, and managing your app

  • A decorator based API for integrating with Amazon API Gateway, Amazon S3, Amazon SNS, Amazon SQS, and other AWS services.

  • Automatic IAM policy generation

You can create Rest APIs:

from chalice import Chalice

app = Chalice(app_name="helloworld")

@app.route("/")
def index():
    return {"hello": "world"}

Tasks that run on a periodic basis:

from chalice import Chalice, Rate

app = Chalice(app_name="helloworld")

# Automatically runs every 5 minutes
@app.schedule(Rate(5, unit=Rate.MINUTES))
def periodic_task(event):
    return {"hello": "world"}

You can connect a lambda function to an S3 event:

from chalice import Chalice

app = Chalice(app_name="helloworld")

# Whenever an object is uploaded to 'mybucket'
# this lambda function will be invoked.

@app.on_s3_event(bucket='mybucket')
def handler(event):
    print("Object uploaded for bucket: %s, key: %s"
          % (event.bucket, event.key))

As well as an SQS queue:

from chalice import Chalice

app = Chalice(app_name="helloworld")

# Invoke this lambda function whenever a message
# is sent to the ``my-queue-name`` SQS queue.

@app.on_sqs_message(queue='my-queue-name')
def handler(event):
    for record in event:
        print("Message body: %s" % record.body)

And several other AWS resources.

Once you’ve written your code, you just run chalice deploy and Chalice takes care of deploying your app.

$ chalice deploy
...
https://endpoint/dev

$ curl https://endpoint/api
{"hello": "world"}

Up and running in less than 30 seconds. Give this project a try and share your feedback with us here on Github.

The documentation is available on readthedocs.

Project details


Release history Release notifications | RSS feed

This version

1.0

Download files

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

Source Distribution

mod-chalice-1.0.tar.gz (268.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mod_chalice-1.0-py2.py3-none-any.whl (285.6 kB view details)

Uploaded Python 2Python 3

File details

Details for the file mod-chalice-1.0.tar.gz.

File metadata

  • Download URL: mod-chalice-1.0.tar.gz
  • Upload date:
  • Size: 268.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.0.0 pkginfo/1.5.0.1 requests/2.20.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.5

File hashes

Hashes for mod-chalice-1.0.tar.gz
Algorithm Hash digest
SHA256 ad401adc83e39d22537884001beb566864be89f9239b86de31afdfbb578a6b48
MD5 7d105745271bf5f8eda94ab3e280bc31
BLAKE2b-256 925266523ae3e08aad3c375eb9e186c240f688dbaf81e7e8c27d22b1fbec805e

See more details on using hashes here.

File details

Details for the file mod_chalice-1.0-py2.py3-none-any.whl.

File metadata

  • Download URL: mod_chalice-1.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 285.6 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.0.0 pkginfo/1.5.0.1 requests/2.20.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.5

File hashes

Hashes for mod_chalice-1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 512093dfaa670b045550f239233896b5ea6a687ba6b1097ff8e13190012e1c6a
MD5 7f7f2e9be357bf31eaf02b05d5e05ff3
BLAKE2b-256 21ccbf07c965d75cf5a35a873e34cdde586bddc552debaa07cb9978536b9c4e7

See more details on using hashes here.

Supported by

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