chili-pepper
chili-pepper

chili_pepper package

Submodules

chili_pepper.app module

class chili_pepper.app.App(app_name, config=None)[source]

Bases: object

Cloud-agnostic App class

App is the main class for applications that use Chili-Pepper.

app_name

The application name.

task(environment_variables=None)[source]

The decorator to denote tasks. It must be implemented by cloud-specific App child classes.

Parameters

environment_variables – Environment variables to apply to the task

task_functions

The task functions identified with the @app.task decorator

class chili_pepper.app.AppProvider[source]

Bases: enum.Enum

Enum to identify the serverless provider.

Currently unused.

AWS = 1
class chili_pepper.app.AwsApp(app_name, config=None)[source]

Bases: chili_pepper.app.App

bucket_name

The AWS S3 bucket name that holds the lambda deployment packages

runtime

The AWS lambda runtime identifier.

task(environment_variables=None)[source]

The decorator to denote tasks. It must be implemented by cloud-specific App child classes.

Parameters

environment_variables – Environment variables to apply to the task

class chili_pepper.app.ChiliPepper[source]

Bases: object

create_app(app_name, app_provider=<AppProvider.AWS: 1>, config=None)[source]

[summary]

Parameters
  • app_name ([type]) – [description]

  • app_provider ([type], optional) – [description]. Defaults to AppProvider.AWS.

  • config ([type], optional) – [description]. Defaults to None.

Raises

ChiliPepperException – [description]

Returns

[description]

Return type

[type]

exception chili_pepper.app.InvalidFunctionSignature[source]

Bases: chili_pepper.exception.ChiliPepperException

Function Signature does not match required specifications

Cloud providers require that functions have a specific signature. This exception is raised when a task does not match the required signature.

exception chili_pepper.app.InvocationError[source]

Bases: chili_pepper.exception.ChiliPepperException

Raised when there was a problem invoking the serverless function

class chili_pepper.app.Result(lambda_function_name, event)[source]

Bases: object

Task result object

Result wraps the information returned when the serverless function is invoked.

get()[source]

Get the response from the serverless execution.

This is a potentially blocking call.

It will retrieve the return payload from the serverless function. If it is called before the serverless function has finished, get will block until the serverless function returns.

Raises

InvocationError – Raises if something goes retrieving the return payload of the serverless function.

Returns

The return payload of the serverless function

Return type

dict

start()[source]

Start executing the serverless function

Invokes the serverless function.

For AWS, this invokes the Lambda in a thread, since the only way to get results is to call syncronously. By putting the invoke call in a therad, it will not block the main application thread.

Returns

The thread running the lambda

Return type

Thread

class chili_pepper.app.TaskFunction(func, environment_variables=None)[source]

Bases: object

A wrapper around python functions that can be serverlessly deployed and executed by chili-pepper

environment_variables

Returns: dict: The environment variable overrides for this function

func

Returns: builtins.function: The python function

chili_pepper.config module

class chili_pepper.config.Config[source]

Bases: collections.abc.MutableMapping

Chili-Pepper specific configuration

chili_pepper.deployer module

class chili_pepper.deployer.Deployer(app)[source]

Bases: object

deploy(dest, app_dir)[source]

Deploys the chili-pepper app

Parameters
  • dest (Path) – The destination for the deployment package.

  • app_dir (Path) – The location of the application source code.

Returns

The cloudformation template that was deployed to AWS.

Return type

str

get_function_id(python_function)[source]

Get a unique identifier for the serverless function

Parameters

python_function (builtins.function) – The python function. Must have been included in the Chili-Pepper app.

Returns

The unique serverless function identification string

Return type

str

chili_pepper.exception module

exception chili_pepper.exception.ChiliPepperException[source]

Bases: Exception

Chili Pepper Exceptions

chili_pepper.main module

class chili_pepper.main.CLI[source]

Bases: object

Implements the chili command line interface

deploy(args)[source]

Deploys a Chili-Pepper app

Parameters

args (argparse.Namespace) – Arguments passed to the command line.

chili_pepper.main.main()[source]

Main Chili-Pepper command line interface handler

Module contents