Reputation: 1047
I am trying to package a local python package¹ and use it within an AWS lambda deployed via the Serverless framework. I already use serverless-python-requirements plugin to add pip dependencies to deployed package.
How can I proceed ?
Shall I create a package and zip it? Or generate a whl file and use pip? And then, how to deploy it?
¹: I cannot just add it to "normal codebase" as I want to share it with other bricks (Glue jobs for example)
Upvotes: 3
Views: 841
Reputation: 1047
Build a .whl
file corresponding to package using
python setup.py bdist_wheel
within a parent directory.
Add the relative path to this .whl
file to used pip requirement file (requirements.txt
for instance) :
req0==1.0.9
req1==5.5.0
../<relative path to local package>/dist/<package name>-<version>-<details>.whl # generated .whl file's name
serverless-python-requirements
will automagically pack this dependency within the deployed archive when doing sls deploy
. How cool is that, huh!
Upvotes: 2