Programmable AWS Lambda for Python

View the Project on GitHub ZhukovAlexander/lambdify

λambdify - because code is the only thing that matters

Build Status PyPI version

DISCLAIMER: lambdify is just a POC, it’s not actively maintained and is not suitable for production use at the moment

lambdify is a tool that turns any python callable into an AWS Lambda function. Create, update and call your lambdas directly from python.

Just like that:

install lambdify

$pip install lambdify

…create AWS Lambda with 4 lines of code:

from lambdify import Lambda

def echo(*args, **kwargs):
    return args, kwargs


if __name__ == '__main__':
    import getpass
    echo(msg='Hello, {user}!'.format(user=getpass.getuser()))

Now you can head over to your AWS Lambda console and behold your echo function. Could creating a serverless program be any easier?

The goal

Lambdify aims to unite convenient task queues API (i.e. Celery, Hue, RQ’s @job decorator) with AWS Lambda service coolest features. Ultimately, lambdify should be capable to become a good alternative to Celery or any other task queue.

At present, there are some solutions, that allow you to create and deploy lambdas, like Zappa, lambda-uploader, lambder etc., but they still have limitations of not being able to interact directly with a python program. lambdify overcomes such limitations by using the following algorithm:

  1. Serialize the callable with it’s globals using dill

  2. Upload the .lambda.dump file containing the serialized function along with the rest of the package

  3. Special module will look for the .lambda.dump file and inject deserialized function into it’s namespace

  4. ????

  5. Profit


>>>from lambdify import Lambda

#Usecases and features

The simpliest task queue ever

def add(a, b):
    return a + b

Lambdas can create and call other lambdas:

def child_function(x, y):
    return x * y
def parent_function(y):
    # this will actually call the cloud instance of
    # child_function
    return child_function(2, y)


P.S. Lambdify is a POC, and at the time allows your lambda to only use site-packages, all local files won’t be packaged, so each user-defined dependency should be contained withing the same file.