Skip to content

pythonRequirements->vendor does not work if package->individually is set to true #208

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

Open
amitm02 opened this issue Jun 19, 2018 · 2 comments
Labels

Comments

@amitm02
Copy link

amitm02 commented Jun 19, 2018

from the code:

if (this.serverless.service.package.individually) {
...
} else {
    installRequirements(
      this.options.fileName,
      '.serverless',
      this.serverless,
      this.servicePath,
      this.options
    );
    if (this.options.vendor) {
      // copy vendor libraries to requirements folder
      copyVendors(this.options.vendor, '.serverless', this.serverless);
    }
  }

I think

if (this.options.vendor) {
   // copy vendor libraries to requirements folder
   copyVendors(this.options.vendor, '.serverless', this.serverless);
}

should be outside the if-else block as probably we want the general - "cross functions" vendor folder to be copied to each module, even if individuality was set to true

@dschep
Copy link
Contributor

dschep commented Jun 19, 2018

That seems right to me too. Feel free to make a PR 👍

@singhabahu
Copy link

@dschep What if I have a vendor library with custom modules that some functions depend on also created by ourselves in below manner.

project-name
   /vendor
      ...
      __init__.py
      /custom
           __init__.py
           package.py
  /functions
      /func1
          __init__.py
          handler.py

Here in my handler.py I have imported package like from vendor.custom import package and because of above issues I used function level vendoring. But when I deploy the code I get all the files in modules copied into function folder without the module structure. Any idea why this is happening or am I doing it in the right way?

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

No branches or pull requests

4 participants