nice-eye-10512
08/04/2023, 5:31 PMdocker run -ti --rm --entrypoint /bin/bash amazon/aws-lambda-python:latest -c "pip list"
Package Version
--------------- -------
awslambdaric 2.0.4
boto3 1.27.1
botocore 1.30.1
jmespath 1.0.1
pip 23.1.2
python-dateutil 2.8.2
s3transfer 0.6.1
setuptools 65.5.0
simplejson 3.17.2
six 1.16.0
urllib3 1.26.15
☝️ Those are already part of the image and I would like to avoid re-packaging them again in the lambdex zip file.
In some other build tools, these are called "provided" dependencies that come from the environment. Maybe I am missing something but I did not figured out how to do that with pants.
Thanks !happy-kitchen-89482
08/04/2023, 6:06 PM!!
syntax, but this would be really good to support.happy-kitchen-89482
08/04/2023, 6:08 PMnice-eye-10512
08/04/2023, 7:16 PMflat-zoo-31952
08/04/2023, 8:36 PMbroad-processor-92400
08/05/2023, 12:17 AM!!
removal is the best option at the moment but it will only work well for direct deps: if those packages appear as transitive deps, they’ll still be included. Eg if a lambda depend on aws_lambda_powertools
that depends on boto, pex will pull in both even with a !!boto3
, aiui.
The exclusion feature in https://github.com/pantsbuild/pants/issues/19256 is relatedbroad-processor-92400
08/05/2023, 5:40 AMflat-zoo-31952
08/05/2023, 5:17 PMnice-eye-10512
08/07/2023, 1:50 PMflat-zoo-31952
08/07/2023, 4:22 PMpants test
and not include them for pants package
. That's possible because the dependencies provided are still part of the pip ecosystem, just provided at a different step down the road. For a DEB/RPM provider, we can't assume that pip versions are equal to versions on those system packages, since distro maintainers can and do cherry-pick and backport fixes, so we have to use those distro packages directly (and have a way of making sure they are installed at the versions we expect in the selected environment, and that we're using the right python interpreter to access them).
This is complicated, and we'll probably need help figuring out what this looks like for the actual use cases we care about here. I'm going to take a whack at https://github.com/pantsbuild/pants/issues/19552 soon and maybe https://github.com/pantsbuild/pex/issues/2097 and that should at least result in a couple of places you could make a UnionRule
to support this for Lambda, and I could support this for RPM.