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.extraPaths 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.pythonPath 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.
In order to make the Python interpreter system-agnostic, changes won’t lead to modifications to the settings.json file. The Python extension will store information about the interpreter in internal storage instead.
This release also adds two new debugger features. The first is the ability to select which targets to step into. When the debugger stops at a breakpoint with multiple function calls, developers can pick the one to step into by right-clicking, selecting “step into targets,” and choosing the desired target.
The second new debugger feature is function breakpoints, which allows developers to specify a function to inspect its behavior. The debugger will stop executing when it reaches that function.
Other new features in the July release include the test explorer only showing file and folder names on nodes, bug fixes for Poetry support, and support for renaming modules with Jedi.