-
-
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
Support pip's --user
option in mypy's --install-types
#16606
Conversation
This comment has been minimized.
This comment has been minimized.
@@ -1561,7 +1572,8 @@ def install_types( | |||
print() | |||
print("Installing missing stub packages:") | |||
assert options.python_executable, "Python executable required to install types" | |||
cmd = [options.python_executable, "-m", "pip", "install"] + packages | |||
pip_options = ["--user"] if options.user else [] |
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.
If more pip options are supported in the future, this could go into a proper derive_pip_options
function or similar
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
Pinging maybe @AlexWaygood, I would love to get your feedback on this topic. |
For anyone else searching for this |
Thanks for the PR! I'm not planning on merging this. I don't want |
Fixes: #16339
This PR adds support for a new command line argument
--user
. This command line argument is intended to be used together with--install-types
throwing an error otherwise.When used with
--install-types
, this new option will pass the--user
flag topip install
so that the missing library stubs are installed to the user's local python package install location.Example