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: Add type checking on condition for mypy-boto3 #5570

Merged
merged 1 commit into from
Jul 19, 2023

Conversation

hnnasit
Copy link
Contributor

@hnnasit hnnasit commented Jul 19, 2023

Which issue(s) does this change fix?

#5566

Why is this change necessary?

mypy_boto3_lambda which is used for type checking purposes breaks the command. boto3-stubs is a dev dependency and not included in the prod dependencies.

How does it address the issue?

Adds a condition to only import this for type checking.

What side effects does this change have?

Mandatory Checklist

PRs will only be reviewed after checklist is complete

  • Add input/output type hints to new functions/methods
  • Write design document if needed (Do I need to write a design document?)
  • Write/update unit tests
  • Write/update integration tests
  • Write/update functional tests if needed
  • make pr passes
  • make update-reproducible-reqs if dependencies were changed
  • Write documentation

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@hnnasit hnnasit requested a review from a team as a code owner July 19, 2023 16:49
Copy link
Contributor

@hawflau hawflau left a comment

Choose a reason for hiding this comment

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

why don't we just move the boto3-stub requirement to base.txt?
My reason is adding typing for boto3 objects is a good practice and we should extend this to entire SAM CLI code base gradually. However, using conditional imports for typing seems to require lots of effort and hard to test. Moving boto3-stub to base.txt as a prod requirement seems more sustainable and maintainable.

Copy link
Contributor Author

@hnnasit hnnasit left a comment

Choose a reason for hiding this comment

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

Yeah, we could add this to base.txt.

Copy link
Contributor Author

@hnnasit hnnasit left a comment

Choose a reason for hiding this comment

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

There are some issues with updating the reproducible files after adding the dependency to base.txt due to the pyyaml issues. We will address moving the dependency to base.txt in a separate PR to unblock remote invoke regression.

@hnnasit hnnasit added this pull request to the merge queue Jul 19, 2023
Merged via the queue into aws:develop with commit 9a4f00d Jul 19, 2023
77 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants