-
Notifications
You must be signed in to change notification settings - Fork 131
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
Upgrade to latest mypy #618
Conversation
PEP-484 has changed to recommend against implicit optionals based on default arguments, and mypy has accordingly flipped the default in a recent release. ref: https://peps.python.org/pep-0484/#union-types
@tzaffi I recall seeing a recent commit from you switching the |
These are semantically equivalent. I think we ought to come to an agreement about what style we ought to adopt going forward -so we don't need to spend any mental calories on it. I propose:
Why? I don't really have a good reason. I could be easily swayed to another viewpoint. But we should adopt some style. |
@@ -2,7 +2,7 @@ black==22.3.0 | |||
flake8==5.0.4 | |||
flake8-tidy-imports==4.6.0 | |||
graviton@git+https://github.com/algorand/[email protected] | |||
mypy==0.950 | |||
mypy==0.991 |
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.
👍
@achidlow noted that the use of Union/Optional are required if the type must be quoted |
That's an argument for not using |
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.
Thanks for upgrading mypy!
I had a small nit regarding the Makefile
.
Also, I won't hold up the PR on account of this, but I created #619 and suggested that we disallow |
for annotations going forward.
…f mypy.ini also, --show-error-codes is default, ref: https://mypy.readthedocs.io/en/stable/error_codes.html#displaying-error-codes
mypy: | ||
mypy --show-error-codes $(MYPY) | ||
mypy |
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.
Why drop the --show-error-codes
arg? It's been handy on occasion.
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.
Not sure if this used to be flipped in a previous mypy
version, but that's the default and assumed. You have to disable it with --hide-error-codes
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.
Thanks for explaining. Yeah, it got flipped: https://github.com/python/mypy/blob/release-0.940/docs/source/error_codes.rst#displaying-error-codes
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.
Looks great, thank you!
PEP-484 has changed to recommend against implicit optionals based on default arguments, and mypy has accordingly flipped the default in a recent release.
ref: https://peps.python.org/pep-0484/#union-types