Serverless template code for Python

Hi,

Can somebody share some inputs or any documentations URLs which explains the dependency management, deployment and packaging of Lambda functions developed in Python?

I could not find anything as clean as nodejs with respect to module management. For example, an npm install --save will install all dependencies locally and deploy it easily. What is the best approach when we do the same thing with Python?

Any help is greatly appreciated.

regards,
Deepu

Check out https://github.com/bennybauer/serverless-python-sample for a python example with pip dependancies =)

My current approach involves using “pip install -t -r requirements.txt” in my code directory… and I hate it.

I’m trying to learn the innards of serverless enough that I can write an alternative packaging config that works by specifying a list of dirs, and for each a list of globs.

This would allow:

  1. Keeping packages in a separate dir
  2. Reversing the questionable choice of how symlinks are currently handled, allowing real symlinks in the bundle (important when your python package carries libs)
1 Like