Python in Visual Studio Code – January 2021 Release

Google+ Pinterest LinkedIn Tumblr +


We are pleased to announce that the January 2021 release of the Python 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 was a short release where we closed a total of 13 issues, and it includes a data viewer when debugging and PYTHONPATH support with Pylance.

If you’re interested, you can check the full list of improvements in our changelog.

The data viewer in the Jupyter and Python extensions allow for easier and cleaner visualization of data when using Jupyter notebooks in VS Code. We’re excited to announce that in this release we added support for the data viewer when debugging Python files as well!

To try it out, you will need to have pandas installed in the selected environment for your workspace. Then, you can just add a breakpoint after the line of the variable you want to inspect, hit F5 and select Python File from the configuration menu:

Python file configuration for debugger configuration

Now when you open the debug view, you can right click on the variable you wish to inspect and select “View in Data Viewer”:

Opening data viewer from variables window in a debug session.

For now, the data viewer only supports 2-dimensional objects, but we’re looking forward to adding support for multi-dimensional objects as well. Stay tuned!

This release includes support to allow you to use the PYTHONPATH variable in .env files with Pylance for improved import resolution. If you’re a Pylance user, your PYTHONPATH specified in .env files is now read alongside any paths included in python.analysis.extraPaths as an import root. In addition, editing the .env file will now update environment variables without any need for a reload.

We have also added small enhancements and fixed issues requested by users that should improve your experience working with Python in Visual Studio Code. Some notable changes include:

  • Integration with the bandit linter will highlight the variable, function or method for an issue instead of the entire line. Requires latest version of the bandit package to be installed. (thanks Anthony Shaw!) (#15003)
  • Remove code snippets (you can copy the old snippets and use them as your own snippets). (#14781)
  • Updated the logic for parsing and sending selected code to the REPL. (#14048)

We’re constantly A/B testing new features. If you see something different that was not announced by the team, you may be part of the experiment! To see if you are part of an experiment, you can check the first lines in the Python extension output channel. If you wish to opt-out of A/B testing, you can open the user settings.json file (View > Command Palette… and run Preferences: Open Settings (JSON)) and set the “python.experiments.enabled” setting to false.

Be sure to download the Python extension for Visual Studio Code now to try out the above improvements. If you run into any problems or have suggestions, please file an issue on the Python VS Code GitHub page.


  Source Link


Leave A Reply