We are pleased to announce that the September Python extension extension for Visual Studio Code is now available. You can
download the Python extension from the Marketplace or install it directly from the extension gallery in Visual Studio Code. If you already have the Python extension installed, you can also get the latest update by restarting Visual Studio Code. You can learn more about Python support in Visual Studio Code
in the documentation .
This is a small release in which we covered 35 issues, including improved Python Language Server, debugging Jupyter Notebook cells, and detecting the creation of a virtual environment. A complete list of improvements is provided in our
changelog . Well, in this article we will consider the most interesting updates.
Improvements in the Python Language Server
The Python Language Server now has linting capabilities, and its latest release includes new linting messages and a number of additional general enhancements, which are listed in the Other Changes and Improvements section below.
Linting messages provided by the Python Language Server include detecting unresolved imports, undefined variables, too many arguments in a function call, unknown keyword arguments, and inheritance from something that is not a class. To see a complete list of Linting posts, you can check out the
documentation in
the Language Server repository on GitHub or
on the settings help page in the Python documentation for Visual Studio.
In addition, we added general support for #noqa, so linting messages can be disabled in each case. The lines with the comment #noqa will have the diagnostic output disabled. You can check the
documentation for more information.
Jupyter Notebook Cell Debugging Enhancements
In the August release, we added the ability to debug Jupyter Notebooks cells, where you can enter custom code. In this release, this feature is expanded to include entering non-user code if necessary. To enable the feature, open the settings page (File> Preferences> Settings), find "Data Science: Debug Just My Code" and uncheck the box.
Once the setting is disabled, you can start calling functions and, for example, check the behavior of non-user code and how the variables change when it is executed.
Virtual Environment Creation Detection
The Python interpreter displayed in the status bar indicates which environment the Python extension uses to run Python code (for example, using the Python command: Run Python File in Terminal) and to provide language services such as autocomplete, syntax checking, linting, formatting, and etc.
In this issue, when creating a new virtual environment, the question will be displayed if you want to choose its interpreter for the workspace:
This will add the path to the Python interpreter from the new virtual environment to the settings of your workspace, and therefore this environment will be used when installing packages and executing code through the Python extension.
Other changes and improvements.
We also added minor improvements and bug fixes requested by users, which should improve your experience with Python in Visual Studio Code. Some notable changes include:
- Update Jedi to 0.15.1 and parso to 0.5.1. ( # 6294 )
- PTVSD up to 4.3.2.
- Added a setting that allows you to execute Python code when loading an interactive window. ( # 6842 )
- General improvements for Python Language Server
We continue to A / B test new features. If you see some kind of error that was not announced by the team, you can participate in the experiment! To find out if you are participating in an experiment, you can check the first lines in the Python extension's output port. If you want to abandon A / B testing,
disable telemetry in Visual Studio Code .
Be sure to download
the Python extension for Visual Studio Code to try out the above improvements. If you encounter any problems, please
report them on
the Python VS Code page on GitHub .