Python in Visual Studio Code – February 2024 Release

Courtney Webster

We’re excited to announce the February 2024 release of the Python and Jupyter extensions for Visual Studio Code!

This release includes the following announcements:

  • Python debugger extension installed by default
  • Create Environment option in the Python interpreter Quick Pick
  • Jupyter’s built-in variable viewer
  • New diagnostic rules with Pylance
  • VS Code triggered breakpoints with Python

If you’re interested, you can check the full list of improvements in our changelogs for the Python, Jupyter and Pylance extensions.

Python Debugger extension installed by default

The Python Debugger extension is now installed by default alongside the Python extension.

The Python Debugger extension aims to separate the debugging functionality from the main Python extension to prevent compatibility issues. This ensures that even as the Python extension drops support for older Python versions (e.g., Python 3.7), you can continue debugging projects with those versions without downgrading the Python extension. It also delivers platform-specific builds, ensuring you only receive the components relevant to your specific operating system, reducing download times and unnecessary overhead.

The Python Debugger extension enables all the functionality you are used to and more!

To ensure you are using the new Python Debugger extension, replace "type": "python" with "type": "debugpy" in your launch.json configuration file. In the future, the Python extension will no longer offer debugging support, and we will transition all debugging support to the Python Debugger extension.

Create Environment option in the Python interpreter Quick Pick

You can now more conveniently create a Python environment from the Python interpreter Quick Pick. Run the Python: Select Interpreter command, and then select the Create Virtual Environment option to create a new virtual environment for your project.

Screenshot of the Create Virtual Environment option in the Select Interpreter Quick Pick.

Jupyter’s built-in variable viewer

The Jupyter extension has added an experimental variable viewer to the Run and Debug panel. You can enable this experience by adding "notebook.experimental.variablesView": true in your User settings.json file. This built-in variable view can be used to view variables from your notebook kernel, helping you monitor variables in your program as your code is run. This is especially helpful when debugging your code as you can monitor the value of your variables in real time.

The built-in variable viewer is still under active development. Feedback and suggestions are welcomed in the vscode-jupyter repo.

New diagnostic rules with Pylance

Pylance, which is powered by Pyright, used to display reportGeneralTypeIssues diagnostics for a variety of typing issues in your code when type checking mode is enabled. This diagnostic rule has been modified in Pyright to allow for a more granular control over the diagnostics and is now available in Pylance Pre-Release. The reportGeneralTypeIssues diagnostic has been broken down into the following new rules:

  • reportAbstractUsage
  • reportArgumentType
  • reportAssertTypeFailure
  • reportAssignmentType
  • reportAttributeAccessIssue
  • reportCallIssue
  • reportInconsistentOverload
  • reportIndexIssue
  • reportInvalidTypeArguments
  • reportInvalidTypeForm
  • reportNoOverloadImplementation
  • reportOperatorIssue
  • reportPossiblyUnboundVariable
  • reportRedeclaration
  • reportReturnType
  • reportUnusedExcept

You can refer to the configuration documentation for more details about each of them.

VS Code Triggered Breakpoints with Python

VS Code has added support for triggered breakpoints! Triggered breakpoints are breakpoints that are automatically enabled once another breakpoint is hit. For example, this can be very useful when diagnosing failure cases in code that happen only after a certain pre-condition.

Triggered breakpoints can be set by right-clicking on line gutter, selecting Add Triggered Breakpoint…, and then choosing which breakpoint enables this one.

Gif demonstrating triggered breakpoints in a Python project.

Support for triggered breakpoints is enabled for all languages, not just Python!

Other Changes and Enhancements

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

  • Fix duplicated suggestions for Python and avoid launching another language server in @vscode-jupyter#13596.
  • Added support for multi-level pytest classes allowing for top-level classes to be displayed in the Test Explorer in @vscode-python#22520.
  • Interpreter quick pick now displays the name of conda environments to make it easier to identify them in @vscode-python#21770.
  • New Python Quick Start docs page to get you up and coding quickly!

We would also like to extend special thanks to this month’s contributors:

Call for Community Feedback

As we are planning and prioritizing future work, we value your feedback! Below are a few issues we would love feedback on:

Try out these new improvements by downloading the Python extension and the Jupyter extension from the Marketplace, or install them directly from the extensions view in Visual Studio Code (Ctrl + Shift + X or ⌘ + ⇧ + X). You can learn more about Python support in Visual Studio Code in the documentation. If you run into any problems or have suggestions, please file an issue on the Python VS Code GitHub page.


Discussion is closed.

Feedback usabilla icon