-
Notifications
You must be signed in to change notification settings - Fork 3k
Enable mypy on Python #1041
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
Enable mypy on Python #1041
Conversation
| import logging | ||
|
|
||
| import fastavro | ||
| import fastavro # type: ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this going to be needed for every import that doesn't use type annotations?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes for now, or we can disable it. More and more packages will have types in the future :)
| visit(write_schema, CheckCompatibility(read_schema, False)) | ||
|
|
||
| NO_ERRORS = [] | ||
| NO_ERRORS: List[str] = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this also be a tuple?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I meant was: should this be tuple() because it is a constant and should not be mutable?
I am 👍 as well. I am not a huge fan of the visual distractions and verbosity of mypy annotations however once integrated into CI it should pull its weight. |
xhochy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1, this definitely helps to detect some subtle errors. I would though set --ignore-missing-imports instead of the numerous # type: ignore on third-party imports.
|
@Fokko, could you use |
|
I've updated the tox command. I've also pulled in the latest master to make sure that it works with latest master. |
|
Thanks all for the review. I agree that it makes the code a bit more verbose, but this makes it also more accessible for newcomers 👍 |
|
Merging. Thanks for adding this, @Fokko! |
To enable type-checking we would like to enable mypy onto the python code :)