-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Don't look in user site packages when using a virtual env #11444
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
Don't look in user site packages when using a virtual env #11444
Conversation
mypy/pyinfo.py
Outdated
if ( | ||
hasattr(site, 'getusersitepackages') | ||
and hasattr(site, 'getsitepackages') | ||
and site.ENABLE_USER_SITE |
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.
We should still look in the directories returned by site.getsitepackages
even if site.ENABLE_USER_SITE
is false unless I'm mistaken.
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.
Oh yes. Good catch.
yay CI is green \o/ |
This is a follow up from #11444
This is a follow up from #11444
This is a follow up from python#11444
Description
Fixes #11274
As suggested in the above issue, we need to add user site packages to the list of directories only if site.ENABLE_USER_SITE is True.
Test Plan
Before the patch:
After the patch:
where
venv
is the virtualenv for mypy development, as indicated in CONTRIBUTING.txtFinally, we can check that pinfo still works outside a virtualenv: