Skip to content

Installing SDK without botocore and other transitive dependencies #378

Description

@corey-cole

I'm using the SDK in a Lambda function, meaning AWS automatically provides a fairly recent version of boto3/botocore and JMESPath. Installing botocore brings in 10MB of code and results in the overall deployment package being over the limit at which code can be displayed in the AWS console.

Is there a way to only install the SDK without it's dependencies? I suppose it's possible to have multiple requirements files and install the X-Ray one with "--no-dependencies", but that just pushes extra complication into CI/CD. It would be awesome if I could do something like "pip install aws-xray-sdk[core]" (or slim or whatever). I can accept that it might require a note that having a really new version of the SDK might have problems if my provided botocore is too old.

Activity

  1. corey-cole commented on Jan 23, 2023

    @corey-cole
    Author

    Incremental suggestion: The AWS Lambda Powertools are packaged such that it excludes boto3 etc, but users can include the SDK if desired (i.e. for local testing). https://github.com/awslabs/aws-lambda-powertools-python/releases/tag/v2.0.0

    For example, installing locally and letting pip pick out the associated version of boto3 is managed via pip install aws-lambda-powertools[aws-sdk]

  2. willarmiros commented on Jan 24, 2023

    @willarmiros
    Contributor

    Hi @corey-cole - thanks for the request and for raising the Lambda powertools as an option. We are open to a PR for this enhancement, otherwise it will be on our backlog for now.

  3. leandrodamascena commented on May 16, 2023

    @leandrodamascena

    Hi XRay team! I was wondering here if I could work on this and submit a PR. This is actually a huge improvement for anyone using the Lambda Runtime or even another container that comes with botocore as we can take ~77MB out of the deployment package.

    I've been using the XRAY SDK for Python for a long time, but this is the first time I've seen the build package and tests. I see that in install_requires you always include botocore, and I don't think we can create a tiny package without a potential breaking change for the non-Lambda runtime, which brings botocore by default. We can remove botocore and add extras_require as an optional dependency, but this will be a potential breaking change for those who just type pip install aws-xray-sdk.
    I thought we could create an extras_require that would install something by default, but it looks like setuptools doesn't support that - pypa/setuptools#1139.

    Do you know if there is another alternative to solve this? It might be interesting if we can find a solution to do this without a breaking change.

    Thank you

  4. leandrodamascena commented on May 16, 2023

    @leandrodamascena

    I see now that there's a issue listing big changes to v3, so if there's no option other than to a breaking change, I think we might as well add this in v3.

    #261

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions