-
Notifications
You must be signed in to change notification settings - Fork 767
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
Import resolution errors should show more information about the environment in use #4368
Comments
@karthiknadig, was wondering if you had any thoughts on this. The idea is to change import errors to:
|
I like the idea, but from implementations perspective there are few things to consider since it can significantly impact performance.
This might get very expensive. What we have seen is that people generally create environments globally and don't really clean up. That means that often people have hundreds of environments. Searching each of these for list of installed packages can be very expensive. So, we need to be creative about how we look for things. /cc @karrtikr : we might need to suggest selecting a environment more strongly if there is one already available in user's workspace.
This would have to be heuristic. The heuristic would be how closely matched is the environment to the one expected by the user. Since version of packages or python also has impact on if the user is able to import something or not. |
If we can at least know what we are looking for for some set of imports, we may not have to actually search for something that satisfies an import, but can just see if the expected package is present. I'd suggest doing that based on timestamps too, so we check recently created environments first. We can also check venv files to try short-circuit this. |
There were more ideas, figured I'd save them here: Other ideas include:
|
Minispec
|
Spec based on the discussion in microsoft/vscode-python#21456 Message:
Quick Actions:
For the "Learn more", I think it would be best to add a section to https://code.visualstudio.com/docs/python/environments#_working-with-python-interpreters and/or https://code.visualstudio.com/docs/python/editing#_troubleshooting-intellisense I can work on drafting the information in the documentation for "Learn more"! |
This issue has been fixed in prerelease version 2023.7.41, which we've just released. You can find the changelog here: CHANGELOG.md |
We actually backed out half of this. I forgot. We need to reimplement this behind an experiment. |
We had a hypothesis that users were not picking virtual environments inside of VS code.
This was validated during a recent QP study.
One potential solution is to:
The text was updated successfully, but these errors were encountered: