Skip to main content

Alexa Skills Kit SDK for Python 3.6

Project description

echokit

Lightweight SDK for the Alexa Skills Kit (Python 3.6)

Why?

I felt other solutions were either too clunky, or not quite focused on deployment in AWS Lambda (execution time is money!). That’s why echokit has no dependencies!

Installation

Requirements:
  • Python >= 3.6 (that’s it!)

Using pip:

$ pip install echokit

From GitHub:

Clone/download this repo and run this from the echokit/ directory:

$ python setup.py install

Sample

A sample skill using echokit can be found at this repo: https://github.com/arcward/echokit-example

Documentation

More comprehensive documentation can be found on ReadTheDocs:

http://echokit.readthedocs.io/en/latest/

Getting Started

When you configure your Lambda function, you need to specify a handler. And when you configure your skill in the Alexa dev portal, you’ll be provided an application ID for your skill. Set these at the top of your module:

import echokit

# Set as your skill's handler in Lambda
handler = echokit.handler
# Set as your application ID from the Alexa dev portal
echokit.application_id = "your_application_id"

If your module is main.py, in your Lambda configuration, you’d set main.handler as your handler.

Example

import echokit
from echokit import Response, PlainTextOutputSpeech, SimpleCard

handler = echokit.handler
echokit.application_id = "my_app_id"

@echokit.on_session_launch
def session_started(request_wrapper):
    return echokit.ask('Hello!')

@echokit.on_session_ended
def session_ended(request_wrapper):
    # Print statement will log the reason to CloudWatch
    print(request_wrapper.request.reason)

@echokit.on_intent('OrderIntent')
@echokit.slot('MenuItem', dest='menu_item')
def order_intent(request_wrapper, menu_item):
    print(menu_item)
    request = request_wrapper.request
    menu_item = request.intent.slots['MenuItem'].value
    return echokit.tell(f"You just ordered {menu_item}")\
        .simple_card(title="Previous order", content=menu_item)

Creating a Lambda deployment package

For reference, see the official docs.

echodist

echodist is a script included to help create ZIP deployment packages. If you installed via setup.py, you can run it from the command line (try echodist --help).

Specify your top-level package directory with --dir. For example, if your __init__.py is located at ~/somepy/somepy/__init__.py you would run:

~ & echodist --dir ~/somepy/somepy

This would create somepy.zip in your home directory (or whever you ran the command). If you unzip it, you can see it includes the entire subtree of the directory you specified, as well as an echokit/ directory.

Manually

Your ZIP file should be created from within your top-level package (don’t just zip the enclosing directory). You’ll need to download/clone echokit and include echokit/ in in that same top-level directory. So if your __init__.py is in ~/my_project/ you should have ~/my_project/echokit.

See the official docs for more info.

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

echokit-0.3.1.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

echokit-0.3.1-py3-none-any.whl (13.2 kB view details)

Uploaded Python 3

File details

Details for the file echokit-0.3.1.tar.gz.

File metadata

  • Download URL: echokit-0.3.1.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for echokit-0.3.1.tar.gz
Algorithm Hash digest
SHA256 41afd617c82b1ed2eee99f4329f6d2344f43e3c6f91a51474004e5f279f7dbf7
MD5 d965bb97bb0aa8f7a56c534341d62bc7
BLAKE2b-256 046d8eeab0f8ac821b1482aae4fe360f4daabeefc695b303c4f1880f8d3ada3a

See more details on using hashes here.

File details

Details for the file echokit-0.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for echokit-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 357403e67d863db8f911df3f6231728b65bc4eab1632f4a23199de99da55ca00
MD5 776da9cb13b76c4f9f37dc3423939656
BLAKE2b-256 b6babfb2424bce49f9d20e10ed9a84a544f93dbc9b48ce2588d761762b6b85d3

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