Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installing SDK without botocore and other transitive dependencies #378

Open
corey-cole opened this issue Jan 19, 2023 · 4 comments
Open

Comments

@corey-cole
Copy link

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.

@corey-cole
Copy link
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]

@willarmiros
Copy link
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.

@leandrodamascena
Copy link

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

@leandrodamascena
Copy link

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
Projects
None yet
Development

No branches or pull requests

3 participants