Language: Python Framework: Serverless v1.0
Typically I would run pip freeze > requirements.txt
in the project root
How can I get these dependencies packaged into every deploy?
Language: Python Framework: Serverless v1.0
Typically I would run pip freeze > requirements.txt
in the project root
How can I get these dependencies packaged into every deploy?
create
requirements.txt
pip freeze > requirements.txt
create a folder with all the dependencies:
pip install -t vendored -r requirements.txt
Note that in order to use these dependencies in the code you'll need to add the following:
See https://stackoverflow.com/a/36944792/1111215 for another example.
UPDATE: Instead of the bullet (2) and the code above, you can now use the serverless-python-requirements plugin:
install the plugin
and add the plugin to your
serverless.yml
Don't forget to make sure you have a
requirements.txt
file.That's it, once
sls deploy
is called the plugin will package the dependencies with the code.For a full sample take a look at the serverless-python-sample.
I had similar problem, took these steps to deploy with dependencies. https://stackoverflow.com/a/41634501/2571060