Skip to content

Disable implicit optional for mypy #97

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

Merged
merged 1 commit into from
Jan 4, 2023

Conversation

markkuhn
Copy link
Contributor

@markkuhn markkuhn commented Jan 4, 2023

Description of changes:
mypy's default config for no_implicit_optional is True which causes mypy to treat arguments with a None default value as having an implicit [Optional]. This was causing our recent builds to fail.

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

@markkuhn markkuhn requested a review from meshwa19 January 4, 2023 19:25
@markkuhn markkuhn self-assigned this Jan 4, 2023
@markkuhn markkuhn requested a review from gordonpn January 4, 2023 19:39
@markkuhn markkuhn merged commit a78d1b9 into awslabs:master Jan 4, 2023
@markkuhn markkuhn deleted the kuhnmar/mypy-fix branch January 4, 2023 19:48
meshwa19 added a commit to meshwa19/aws-embedded-metrics-python that referenced this pull request Jan 5, 2023
disable implicit optional for mypy (awslabs#97)
@markkuhn markkuhn added the chore Tasks such as style improvements or refactoring label Mar 2, 2023
@hussam789
Copy link

PR Code Suggestions ✨

CategorySuggestion                                                                                                                                    Impact
General
Enable stricter type checking

Setting no_implicit_optional to True would be more consistent with the strict
typing approach shown in the rest of the configuration. When False, it allows
None as a valid value for arguments without an explicit Optional annotation,
which can lead to unexpected runtime errors.

mypy.ini [17]

-no_implicit_optional = False
+no_implicit_optional = True
  • Apply this suggestion
Suggestion importance[1-10]: 5

__

Why: The suggestion changes no_implicit_optional from False to True to enforce stricter type checking, which is a moderate configuration change that may improve consistency; however, it's a preference adjustment rather than a critical bug fix.

Low
  • More

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Tasks such as style improvements or refactoring
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants