When I'm packaging a `python_aws_lambda_function` ...
# general
c
When I'm packaging a
python_aws_lambda_function
and exclude dependencies that I am going to package in a
python_aws_lambda_layer
is it intentional that a dependency that has an override is included? I have the override defined
"aws-lambda-powertools": {"dependencies": [":reqs0#pydantic", ":reqs0#pydantic-extra-types"]}
but when I package a lambda that I specifically exclude
aws-lambda-powertools
and
pydantic
, it will still package
pydantic-extra-types
in the
python_aws_lambda_function
zip. I can also exclude
pydantic-extra-types
which isn't a problem but it seems like since I am excluding
aws-lambda-powertools
that the zip should not pull in it's dependencies.
b
Sorry, I'm not sure I fully understand the scenario. Can you spell out the BUILD files explicitly or even create a reproducer?
c
Yeah. I can repro this in the example serverless repo. If I modify this BUILD file: https://github.com/TonySherman/example-serverless/blob/a1d8ee00ce1355c17b8f5adb2debd1a9fc0217b2/aws/example_rest_api/api/BUILD and run
pants package ::
the zips for the lambda no longer have aws_lambda_powertools included which is great. The zips, however, do include the
jmespath
dependency that is only declared in the root BUILD file as an override.
I would expect that if I add
dependencies=["//:root#aws-lambda-powertools"]
to a
python_aws_lambda_function
it would exclude
jmespath
since the only reason Pants knows to package
jmespath
is that I explicity told it to.