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

Set implicit_optional=True for mypy #1155

Conversation

jorgenherje
Copy link
Collaborator

mypy with version >= 0.990 has changed its default to no_implicit_optional=True. This implies error for all missing Optional or Union[..., None] where default value is set to None.

Temporary solution is to set implicit_optional=True in mypy.ini as plugin __init__-functions cannot handle usage of Optional when JSON Schema is generated using typehints runtime.

Closes: #1154

- Allow implicit optional until pydantic handles JSON Schema generation.
- Plugin __init__() methods cannot have `Optional` at all times
@jorgenherje jorgenherje added the enhancement 🚀 New feature or request label Nov 8, 2022
@jorgenherje jorgenherje self-assigned this Nov 8, 2022
Copy link
Collaborator

@anders-kiaer anders-kiaer left a comment

Choose a reason for hiding this comment

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

👍 LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement 🚀 New feature or request
Projects
Status: Done 🏁
Development

Successfully merging this pull request may close these issues.

Fix no_implicit_optional=True for mypy >= 0.990
2 participants