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

Adjust for mypy --no-implicit-optional #465

Closed
khaeru opened this issue Nov 7, 2022 · 0 comments · Fixed by #500
Closed

Adjust for mypy --no-implicit-optional #465

khaeru opened this issue Nov 7, 2022 · 0 comments · Fixed by #500
Assignees
Labels
ci Continuous integration
Milestone

Comments

@khaeru
Copy link
Member

khaeru commented Nov 7, 2022

As of mypy 0.990 (or 0.980, unclear), --implicit-optional is disabled by default. This results in type checking failures downstream, e.g. here in message_data (private) with many messages like:

ixmp/ixmp/core/platform.py:61: error: Incompatible default for argument "name" (default has type "None", argument has type "str")  [assignment]
ixmp/ixmp/core/platform.py:61: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
ixmp/ixmp/core/platform.py:61: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase

As mitigation:

  • Give --implicit-optional explicitly when type checking, e.g. in "lint" CI workflows for ixmp or downstream packages.

As a fix:

@khaeru khaeru added the ci Continuous integration label Nov 7, 2022
khaeru added a commit that referenced this issue Nov 9, 2022
Satisfy mypy 0.990 in .base.Backend.get_log_level()
khaeru added a commit to iiasa/message_ix that referenced this issue Nov 9, 2022
khaeru added a commit to iiasa/message_ix that referenced this issue Nov 9, 2022
khaeru added a commit to iiasa/message_ix that referenced this issue Nov 9, 2022
khaeru added a commit to iiasa/message-ix-models that referenced this issue Feb 6, 2023
- Address no_implicit_optional within message_ix_models.
- Work around iiasa/ixmp#465 via pyproject.toml.
@khaeru khaeru added this to the 3.8 milestone Nov 14, 2023
@khaeru khaeru linked a pull request Nov 14, 2023 that will close this issue
4 tasks
@khaeru khaeru self-assigned this Nov 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci Continuous integration
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant