lambdify allows you to create function directly from the code. Just like that:


install 


…create AWS Lambda with 4 lines of code:


from lambdify import Lambda
@Lambda.f(name='echo')
def echo(*args, **kwargs):
    return args, kwargs
echo.create()
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 echofunction


Lambdify aims to unite convenient task queues API (i.e. CeleryHueRQ’s @job decorator) with AWS Lambda service coolest features.


At present, there are some solutions, that allow you to create and deploy lambdas, like Zappalambda-uploaderlambder 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 container.py module will look for the .lambda.dump file and inject deserialized function into it’s namespace


  4. ????


  5. Profit


>>>from lambdify import Lambda
>>>help(Lambda)
  • [ ] Tests
  • [ ] Local modules dependencies
  • [ ] Versioning
  • [ ] InvocationType=’Event’|’RequestResponse’|’DryRun’
  • [ ] etc.


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.



Source link

LEAVE A REPLY

Please enter your comment!
Please enter your name here