It would be nice if different functions could have different requirements
example:
โโโ serverless.yml
โโโ function1
โ โโโ requirements.txt
โ โโโ index.py
โโโ function2
โโโ requirements.txt
โโโ index.py
This is a good idea - but a little tricky. The way serverless framework handles individual zips under the hood is a little bit complex, so handling this may be wasteful of overall space. For functions with the same requirements, you'd end up with an almost-identical zip file & double the time to upload and such.
To do this well, there'd probably have to be a check of duplicate requirements so functions with the same ones could share an artifact.
Hello,
I would definitely like the implementation of this feature.
I am currently using gordon for some of my lambda deployments and I would like to switch to serverless. But in gordon I use a requirements.txt file per functions because some of my functions use heavy dependencies and I dont want them to affect the other light functions. Plus I'd like to mix some python and node into the same serverless project, including the python dependencies into the node lambdas feels a bit weird.
What about these similar plugins?
https://github.com/cfchou/serverless-python-individually
https://github.com/ubaniabalogun/serverless-package-python-functions
Following @ryansb work on #117 I think this could be relatively easily implemented by looking for a requirementsFileName under functions that overrides the custom.pythonRequirements.fileName option when using package.individually=true
Very interested by this enhancement as well!
Indeed, other plugins mentioned by @Tethik are focused on doing this, but I don't think they are compatible with serverless-python-requirements as they also implement the pip install process, but I feel like they are less features rich.
For example, even though these plugins implement the pip install process inside a docker container (useful for Numpy dependency, etc.) you can't have private repositories as requirements (see #69).
That's why I'd rather see this feature in this plugin. I'm gonna try to implement it, but as I'm quite new to the serverless environment (and not a very experienced node developer), I'll probably need some help! :smiley:
Most helpful comment
This is a good idea - but a little tricky. The way serverless framework handles individual zips under the hood is a little bit complex, so handling this may be wasteful of overall space. For functions with the same requirements, you'd end up with an almost-identical zip file & double the time to upload and such.
To do this well, there'd probably have to be a check of duplicate requirements so functions with the same ones could share an artifact.