<#11324 Transitive excludes on python requirements...
# github-notifications
c
#11324 Transitive excludes on python requirements do not work for external libraries Issue created by jsirois Transitive dependency excludes do not work for packages defined in external librarie's
requirements.txt
Given this in `3rdparty/python/BUILD`:
Copy code
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:
Copy code
someotherlib==2.0.0
and this in
src/mylib/BUILD
Copy code
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 `boto3`and `botocore`packages, 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-caching`library, 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. pantsbuild/pants