Python in Visual Studio Code – February 2021 Release
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
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!
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 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.
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.