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 for import of TypedDict for Python versions older than 3.8 #373

Merged
merged 4 commits into from
Jan 7, 2021

Conversation

sigurdp
Copy link
Collaborator

@sigurdp sigurdp commented Jan 6, 2021

The current way of importing TypedDict (for type hinting) using try-except seems to confuse mypy and causes errors during type checking. See for example in: https://github.com/equinor/webviz-subsurface/runs/1647251891?check_suite_focus=true

This PR fixes the issue by checking against Python version instead of using try-except during import.

See:
https://mypy.readthedocs.io/en/stable/common_issues.html#python-version-and-system-platform-checks
and:
python/typeshed#3500 (comment)

Also updated CHANGELOG to reflect the already published release 0.2.5

@sigurdp sigurdp added bug 🐛 Something isn't working CeeSol Task owned by Ceetron Solutions labels Jan 6, 2021
@sigurdp sigurdp self-assigned this Jan 6, 2021
@sigurdp sigurdp marked this pull request as ready for review January 7, 2021 07:32
Copy link
Collaborator

@asnyv asnyv left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@HansKallekleiv HansKallekleiv merged commit f6645ad into equinor:master Jan 7, 2021
@sigurdp sigurdp deleted the sigurdp/mypy-fix branch January 7, 2021 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working CeeSol Task owned by Ceetron Solutions
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants