Don't look in user site packages when using a virtual env - #11444
Merged
emmatyping merged 3 commits intoNov 5, 2021
Conversation
emmatyping
reviewed
Nov 4, 2021
| if ( | ||
| hasattr(site, 'getusersitepackages') | ||
| and hasattr(site, 'getsitepackages') | ||
| and site.ENABLE_USER_SITE |
Member
There was a problem hiding this comment.
We should still look in the directories returned by site.getsitepackages even if site.ENABLE_USER_SITE is false unless I'm mistaken.
Contributor
Author
There was a problem hiding this comment.
Oh yes. Good catch.
emmatyping
reviewed
Nov 4, 2021
Contributor
Author
|
yay CI is green \o/ |
emmatyping
approved these changes
Nov 5, 2021
pranavrajpal
reviewed
Nov 5, 2021
emmatyping
added a commit
that referenced
this pull request
Nov 5, 2021
This is a follow up from #11444
JukkaL
pushed a commit
that referenced
this pull request
Nov 5, 2021
This is a follow up from #11444
tushar-deepsource
pushed a commit
to DeepSourceCorp/mypy
that referenced
this pull request
Jan 20, 2022
tushar-deepsource
pushed a commit
to DeepSourceCorp/mypy
that referenced
this pull request
Jan 20, 2022
This is a follow up from python#11444
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
venvis the virtualenv for mypy development, as indicated in CONTRIBUTING.txtFinally, we can check that pinfo still works outside a virtualenv: