Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include option to maintain the file include paths when copying to build package #16

Open
ubaniabalogun opened this issue Sep 5, 2017 · 8 comments

Comments

@ubaniabalogun
Copy link
Owner

No description provided.

@ubaniabalogun
Copy link
Owner Author

see #8 first comment

@danbovey
Copy link

I think I've solved this issue in my fork at onlicar/serverless-package-python-functions - I've added a new resources option alongside includes and a globalResources option to custom. We have resources on our serverless API like html email templates so we need to copy files in place.

I don't really see a use case for includes as it currently stands - why would you need to copy files to the top level of the lambda zip? I think all users of this plugin will need to copy files in place so that the code structure is the same whether we are online or offline. e.g. when I import a file likerepositories/vehicle.py I do this:

from repositories.vehicles import get_vehicle

Whereas, with includes the way it stands, it would have to be changed to this, (somehow) just for deployment:

from vehicles import get_vehicle

Let me know if I should open a pull request with the current changes (adding resources alongside includes so not a breaking change) or open one that overwrites the includes implementation (breaking change).

@JFox
Copy link
Contributor

JFox commented Oct 24, 2017

+1

@ubaniabalogun
Copy link
Owner Author

@danbovey Thanks for the feedback! Please make a PR request and I'll take a look.

@ashishgajabi
Copy link

I think I've solved this issue in my fork at onlicar/serverless-package-python-functions - I've added a new resources option alongside includes and a globalResources option to custom. We have resources on our serverless API like html email templates so we need to copy files in place.

I don't really see a use case for includes as it currently stands - why would you need to copy files to the top level of the lambda zip? I think all users of this plugin will need to copy files in place so that the code structure is the same whether we are online or offline. e.g. when I import a file likerepositories/vehicle.py I do this:

from repositories.vehicles import get_vehicle

Whereas, with includes the way it stands, it would have to be changed to this, (somehow) just for deployment:

from vehicles import get_vehicle

Let me know if I should open a pull request with the current changes (adding resources alongside includes so not a breaking change) or open one that overwrites the includes implementation (breaking change).

Hi,

How did you solve this issue? I am having very similar issue. Whenever I have to run my unit tests, my import doesn't work. If I change my imports to suit unit tests then aws lambda doesn't like it.

Is there any workaround for this?

Regards,
Ashish

@ashishgajabi
Copy link

As of now, for my unit test cases, I have solved the problem with setting PYTHONPATH. But is there cleaner way of handling this scenario?

Regards,

@rishabhdas
Copy link

Is this feature being worked upon? We are facing a similar condition where we need to copy files in place to a lambda package.

@ericbn
Copy link

ericbn commented May 14, 2022

Hi @danbovey. Did you happen to end up with a solution for this?

As already mentioned here, not having each lambda as an individual package introduces all kinds of issues when you start add unit tests, linting with mypy, etc. to the project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants