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

Transitive excludes on python requirements do not work for external libraries #1146

Closed
GLeurquin opened this issue Dec 16, 2020 · 1 comment

Comments

@GLeurquin
Copy link

Transitive dependency excludes do not work for packages defined in external librarie's requirements.txt

Given this in 3rdparty/python/BUILD:

python_requirement_library(
   name="somelib",
   requirements=["somelib==1.0.0"]
)

python_requirement_library(
   name="someotherlib",
   requirements=["someotherlib==2.0.0"]
)

where somelib's requirements.txt includes someotherlib as a requirement, i.e.:
requirements.txt of somelib:

someotherlib==2.0.0

and this in src/mylib/BUILD

python_library(name="base")

python_awslambda(
    name="awslambda",
    dependencies=[
        ":base",
        "3rdparty/python:somelib",
        "!!3rdparty/python:someotherlib",
    ],
    runtime="python3.8",
    handler="lambda_function:lambda_handler",
)

and running ./pants package src/mylib:awslambda, the resulting package still includes someotherlib (most likely because somelib needs it in its own requirements.txt, and pants does not look like it's aware of that.).

For my use case, I'm trying to use an external library which makes use of boto3 and botocore: aws-secretsmanager-caching, and I need the lambda package to not contain the boto3and botocorepackages, because they take too much space in the lambda package and the lambda runtime already includes them out of the box.

The current workaround I have is to clone the aws-secretsmanager-cachinglibrary, convert it to a pants accepted build folder using BUILD files, and then the exclude works as expected, however this is not ideal since it copies source code from another library into my project.

Any better way to do this ? Is this a feature that's supposed to be supported by pants ? Thanks for your feedback.

@jsirois
Copy link
Member

jsirois commented Dec 16, 2020

@GLeurquin I'm closing this since it's a Pants issue. I re-filed it here: pantsbuild/pants#11324

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

No branches or pull requests

2 participants