Does this plug-in works with serverless-python-requirements?
I have module in serverless.yml and requirement.txt for python, but it completely ignored.
An example of serverless-python-requirements would be great.
Thanks,
Ali
Hi @alikian, Thanks for the issue. The plugin does not take into account serverless-python-requirements at the moment.
We would be grateful to have a PR fixing this.
Best,
As a starting point, you can run sls requirements install to tell serverless-python-requirements to install the modules into the local filesystem (which may involve it compiling C code inside a Docker container identical to the Lambda environment).
You can then set your PYTHONPATH environment variable which serverless-offline will pass to sls invoke local when it runs the Python function, for example:
PYTHONPATH=/path/to/requirements/folder sls offline start
I am not sure whether an implementation of this would better belong in serverless-offline or serverless-python-requirements. I am suspecting serverless-python-requirements would be the better place, if serverless-offline provides a hook when starting the offline environment.
It does provide a hook when starting the offline environment 馃洨
Well, the issue is a little bit more complicated because we are using:
package:
That means our lambdas have different requirements.txt
Hmm sounds like serverless-python-requirements will need to grab the offline hook, then use Python virtual environments to set a per-function virtual environment before launching the function.