-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Add hidden options to disable bytes promotion #13952
Conversation
It might be useful to run mypy_primer without promotions in typeshed. This would give us more confidence in changes stemming from python/typeshed#9001
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, great idea!
I think this should be a public option in the future as part of mypy's migration plan to implement PEP 688, if and when it is accepted. But for now, it's useful as an undocumented option for typeshed.
mypy/main.py
Outdated
@@ -1121,6 +1121,12 @@ def add_invertible_flag( | |||
parser.add_argument( | |||
"--enable-incomplete-features", action="store_true", help=argparse.SUPPRESS | |||
) | |||
parser.add_argument( | |||
"--_disable-bytearray-promotion", action="store_true", help=argparse.SUPPRESS |
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.
I feel like we don't need the underscore if we're already suppressing the flag.
You need to run Black though. |
It might be useful to run mypy_primer without promotions in typeshed. This would give us more confidence in changes stemming from python/typeshed#9001
Looking forward to testing this! Thank you! |
@dvarrazzo fyi, the mypy-primer output in #12661 (comment) should give you an idea of the effect of disabling the promotions on psycopg. Let me know if you run into any issues where the typeshed stubs don't reflect bytes/bytearray types correctly and I'll help fix them. |
@JelleZijlstra I'm afraid I'm not very experienced with running mypy if not from packaged releases. Which repositories should I check out and install in order to try the feature? Thank you! |
The option should be in mypy 0.990, which is expected next week. In the meantime you can simply install from git with |
This will be part of 0.990, which should hopefully be out in a week or two: #13871 But as of today, |
Add `disable_bytearray_promotion`, `disable_memoryview_promotion` and `enable_incomplete_feature` to the mypy schema. The two first properties are undocumented, but are discussed in this PR: python/mypy#13952 The latter option is described in the mypy documentation: https://mypy.readthedocs.io/en/stable/command_line.html#enabling-incomplete-experimental-features This PR closes #3933.
Add `disable_bytearray_promotion`, `disable_memoryview_promotion` and `enable_incomplete_feature` to the mypy schema. The two first properties are undocumented, but are discussed in this PR: python/mypy#13952 The latter option is described in the mypy documentation: https://mypy.readthedocs.io/en/stable/command_line.html#enabling-incomplete-experimental-features This PR closes SchemaStore#3933.
It might be useful to run mypy_primer without promotions in typeshed. This would give us more confidence in changes stemming from python/typeshed#9001