-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Docs for --python-version are wrong #4620
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
Comments
My preference would be to make using PEP 561 installed stubs as simple as possible. The most straightforward way to use installed stubs would be to have both mypy and the stubs use the Python installation used to run mypy. Then no extra mypy options should be needed, if the same Python is also used to install the stub packages. This implies that However, if we make this change, I'd like to update the errors generated when using unsupported syntax to document how to change the target Python version. For example, if the user is using Python 3.5 and tries to use the variable annotation syntax which was introduced in 3.6, the current error isn't necessarily very helpful:
Something like this would be better:
|
Great. I think improving the errors is an optional task; the situation isn't much different now (in fact it's worse now since simply running mypy with a different Python version doesn't help, and the docs are wrong about that). [CC: @ethanhs ] |
This sets the default Python version used for type checking to `sys.version_info`. Fixes #4620. The design of this is such that we set tests to default to the running Python whenever possible, but modify tests that use new syntax and libraries to run on Python 3.5 or 3.6. Example output of failing tests on 3.4 before test changes https://gist.github.com/ethanhs/f782bec70eab0678d9e869465b40a571#file-output-log-L512. This was split out of #4403.
This sets the default Python version used for type checking to `sys.version_info`. Fixes python#4620. The design of this is such that we set tests to default to the running Python whenever possible, but modify tests that use new syntax and libraries to run on Python 3.5 or 3.6. Example output of failing tests on 3.4 before test changes https://gist.github.com/ethanhs/f782bec70eab0678d9e869465b40a571#file-output-log-L512. This was split out of python#4403.
The docs for
--python-version
and the corresponding config option (python_version
) state that they default to the Python version used to run mypy. This is not true and has never been true -- the default is fixed and taken fromdefaults.PYTHON3_VERSION
.In the discussion about the PEP 561 implementation I've talked myself into believing that we should do what the docs state rather than what we currently implement.
@JukkaL Before we go ahead with this change I'd like your opinion, please.
The text was updated successfully, but these errors were encountered: