-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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 --python-executable and --no-infer-executable flags #4692
Conversation
This should be ready for review now. I think the testing I have exercises the new flags well. |
will attempt to find a Python executable of the corresponding version. If | ||
you'd like to disable this, see ``--no-infer-executable`` below. | ||
|
||
- ``--no-infer-executable`` will disable searching for a usable Python |
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 don't think this flag makes any sense without PEP561, and that --no-site-packages
was a better name in that scenario, as it indicated the purpose of the executable
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.
Hm, I think I might agree in principle with the first (but I split this out for ease of review mostly).
As for the flag name, I'm not so sure. If the executable is ever used for anything other than PEP 561, the --no-site-packages
flag would be misleading. It is misleading now anyway, it doesn't actually disable searching, it sets options.python_executable
to None
, which happens to mean that searching for PEP 561 packages is not done.
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.
it sets options.python_executable to None, which happens to mean that searching for PEP 561 packages is not done.
You've got this backwards. options.python_executable is None
is an implementation-detail of how we represent "don't do pep561 searching", chosen over storing a redundant boolean alongside it. We could add a @property def do_pep561_searching
to Options
to make that more explicit, I suppose.
We shouldn't be exposing that detail in the command line arguments.
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.
Hm, I suppose from a user perspective it would be better to name it --no-site-packages
.
Closing as this should be part of the main PEP implementation. |
This implements a flag that allows users to point to a Python interpreter that mypy can use for type checking.
--no-infer-executable
is named as such because the old name (--no-site-packages
) was rather misleading.Fixes #965
Carried over from #4403, with some changes (renaming the flag, documentation).