Microsoft has announced the July 2021 release of the Python Extension for Visual Studio Code.
This release introduces a quicker way of configuring project roots. According to Microsoft, a common issue developers have is that developers see diagnostics under import statements when opening new projects, but they don’t know how to resolve them. Configuring project roots used to require the developer to set python.analysis.extra paths to let Pylance know what search paths to use for import resolution.
Now developers can skip the step of manually changing settings.json and trying to find the right search paths to add. Pylance will now guide them through this process through the editor. To take advantage of this, developers can hover over the diagnostic and click the lightbulb icon or “Quick Fix” in the tooltip to have Pylance suggest search paths.
Another new change in the July 2021 release is that selecting an interpreter doesn’t modify workspace settings anymore. In the past, when a Python interpreter was selected or changed, the python. Python path setting was updated with the path as its value. The path is usually specific to the machine, so this caused problems when developers tried to share their VS Code settings in a GitHub repo.