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

fix(event_source): change the import location of boto3 in CodePipelineJobEvent data class #2353

Merged
merged 3 commits into from
Jun 1, 2023
Merged

fix(event_source): change the import location of boto3 in CodePipelineJobEvent data class #2353

merged 3 commits into from
Jun 1, 2023

Conversation

darnley
Copy link
Contributor

@darnley darnley commented Jun 1, 2023

Issue number: #2352

Summary

Importing boto3 at top level in code_pipeline_job_event.py is affecting performance when import modules that needs aws_lambda_powertools.utilities.data_classes.

Changes

Change the import location of boto3 in code_pipeline_job_event.py to be within function setup_s3_client instead of top level, since this is being used to download an artifact from CodePipeline Job and it is not a common use.

User experience

Decrease of import time when importing modules that uses aws_lambda_powertools.utilities.data_classes, such as ApiGatewayResolver.

Checklist

If your change doesn't seem to apply, please leave them unchecked.

Is this a breaking change?

RFC issue number:

Checklist:

  • Migration process documented
  • Implement warnings (if it can live side by side)

Acknowledgment

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

@pull-request-size pull-request-size bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Jun 1, 2023
@darnley darnley changed the title fix(code_pipeline_job_event): Change boto3 import location fix(data_classes): Change boto3 import location incode_pipeline_job_event Jun 1, 2023
@darnley
Copy link
Contributor Author

darnley commented Jun 1, 2023

Hey @leandrodamascena!
Since this is a very simple change, do you expect or suggest any new unit tests here to be coded? I think the functionality remains the same.

@darnley darnley marked this pull request as ready for review June 1, 2023 02:37
@darnley darnley requested a review from a team as a code owner June 1, 2023 02:37
@darnley darnley requested review from rubenfonseca and removed request for a team June 1, 2023 02:37
@darnley darnley changed the title fix(data_classes): Change boto3 import location incode_pipeline_job_event fix(event_handler): Change boto3 import location incode_pipeline_job_event Jun 1, 2023
@github-actions github-actions bot added the bug Something isn't working label Jun 1, 2023
@leandrodamascena leandrodamascena changed the title fix(event_handler): Change boto3 import location incode_pipeline_job_event fix(event_source): change the import location of boto3 in CodePipelineJobEvent data class Jun 1, 2023
@boring-cyborg boring-cyborg bot added the documentation Improvements or additions to documentation label Jun 1, 2023
@pull-request-size pull-request-size bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jun 1, 2023
@leandrodamascena
Copy link
Contributor

Hey @leandrodamascena! Since this is a very simple change, do you expect or suggest any new unit tests here to be coded? I think the functionality remains the same.

Hi @darnley! Yes, we don't need to do anything else you've already done. I just pushed a commit with minor changes because we merged a PR before that and had a conflict.

Thank you so much for sending this PR at lightning speed. 🚀

@leandrodamascena leandrodamascena requested review from leandrodamascena and removed request for rubenfonseca June 1, 2023 10:19
Copy link
Contributor

@leandrodamascena leandrodamascena left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

APPROVED!
image

@leandrodamascena leandrodamascena merged commit 719cdc0 into aws-powertools:develop Jun 1, 2023
8 checks passed
roger-zhangg pushed a commit to roger-zhangg/aws-lambda-powertools-python that referenced this pull request Jun 5, 2023
…eJobEvent data class (aws-powertools#2353)

Co-authored-by: Leandro Damascena <leandro.damascena@gmail.com>
sthulb pushed a commit that referenced this pull request Jun 19, 2023
…eJobEvent data class (#2353)

Co-authored-by: Leandro Damascena <leandro.damascena@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: High import time when importing ApiGatewayResolver because of CodePipelineJobEvent
2 participants