Python in Visual Studio Code – February 2021 Release

Jeffrey Mew

We are pleased to announce that the February 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 release includes TensorBoard integration, and improvements on docstring readability and code navigation with Pylance. If you’re interested, you can check the full list of improvements in our changelog.

Python Extension Updates

TensorBoard Integration

We’re excited to launch TensorBoard integration within VS Code. TensorBoard is a data science companion dashboard that helps PyTorch and TensorFlow developers visualize their dataset and model training. With TensorBoard directly integrated in VS Code, you can spot check your models’ predictions, view the architecture of your model, analyze you model’s loss and accuracy over time, profile your code to find out where it’s the slowest, and much more!

TensorBoard open on a webview in VS Code.

To start a TensorBoard session, open the command palette (Ctrl/Cmd + Shift + P) and search for the command “Python: Launch TensorBoard”. Afterwards, you will be prompted to select the folder where your TensorBoard log files are located. By default, we will use your current working directory and automatically detect your TensorBoard log files within any subdirectories, but you can also specify your own directory. VS Code will then open a new tab with TensorBoard and its lifecycle will be managed by VS Code as well.

Pylance Extension Updates

Improved docstring readability

We’re excited to announce huge improvements to the readability and formatting of docstrings in Pylance. You can now more easily read docstrings with indented regions (such as parameter blocks in numpy and pandas docs), nested lists (such as those in argparse) and modules that use epydoc formatting (such as OpenCV).

Improved docstring readability with Pylance in VS Code.

Improved go to definition and go to declaration behavior

We’ve also made improvements to code navigation to streamline go to definition and go to declaration behavior and bring you right to where you want to go. Now instead of being presented with a window to choose between the type stub (.pyi) or source file (e.g. .py files) when both are available, go to definition will bring you to the source file, and go to declaration will bring you to the type stub. If either of these calls would otherwise return no results (e.g. go to definition when only a type stub is available), then Pylance will bring you to whichever file is available so that you are still provided with some information about the symbol of interest.

Functionality of go to declaration and go to definition with Pylance in VS Code.

Other Changes and Enhancements

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:

  • Raised the minimum required VS Code version to 1.51. (#15237)
  • Refactored the Enable Linting command to provide the user with a choice of “Enable” or “Disable” linting to make it more intuitive. (thanks henryboisdequin!) (#8800)
  • The “Pylance: Report Issue” command automatically fills out a new GitHub template for simpler language server bug reporting (pylance-release #762)

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.


Discussion is closed. Login to edit/delete existing comments.

  • Stefan Selby 0

    Great work team. Python on Vs code is such a pleasure

  • Adam Nemes 0

    Sounds Great!
    Is Tensorboard Integration supported with SSH connections?

    • Jeffrey MewMicrosoft employee 0

      Yes, the TensorBoard Integration works with the RemoteSSH extension in VS Code!

  • Shr 0

    Great. I like to use this.

  • Sirius Huang 0

    Hi, this sounds great. But I can not find Python: Show Python Interactive Windows using ctrl+shift+p. Is this embedded into the python extension or should I get some other extension?

    • Joyce ErMicrosoft employee 0

      Hi Sirius, we refactored data science-related features, including the interactive window, into a standalone Jupyter extension: The Jupyter extension is included with the Python extension, and the command you are looking for is now ‘Jupyter: Create Interactive Window’.

  • 政之 黄 0

    That’s great. I have tried tensorboard integrated with vs code, and the experience is good. The only problem is that the font on tensorboard’s interface is too small, and my eyes are tired. It would be better if you could add a shortcut key to adjust the interface font.

  • Dr. Schlopp 0

    Thanks again for another great update. Using Python with VSC helps to motivate me to get started and have fun while feeling extremely intuitive/efficient while doing so lol!

Feedback usabilla icon