Lambda function bundles generated with `python_aws...
# general
b
Lambda function bundles generated with
python_awslambda()
are pretty heavy as they embed PEX and wrapping code. Is there an easy way to not use PEX and simply add the project's source code and its dependencies?
h
Funny you should ask, I’ve been meaning to look into this.
👍 1
Right now there isn’t, the lambda implementation uses
lambdex
under the covers, as a shortcut, but it absolutely probably doesn’t need to
b
I may be too much of a perfectionist, and it breaks my heart to see a 500k overhead. 😅 But the truth is that it works well and I can definitely live with it!
So I guess there is no way to avoid bundling boto3? I'd like to do that because its already available remotely (ref: https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html)
h
Not yet, but this is work we’d like to do
👍 1
You can at least exclude
boto3
using the
!!
syntax in the `python_awslambda`’s
dependencies=
E.g.,
dependencies=['!!3rdparty/python#boto3', ...]
b
Where can I find docs about this syntax? Would that keep boto3 in the lockfile?
h
Yeah, it means your tests and everything else still use boto3 from the lockfile, but the packaged lambda would not
b
Awesome, thanks!