Python in Visual Studio Code – September 2021 Release

Savannah Ostrowski

We are pleased to announce that the September 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.

In this release we closed 80 issues, and it includes:

  • A rich Python editing experience in the browser
  • Revamped testing interface
  • New button for running and debugging files on the editor
  • An update regarding the Microsoft Python Language Server’s end of life, as well as for Python 2.7 IntelliSense support.

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

A rich Python editing experience (in the browser!) via

We are delighted to announce that as of this release you can enjoy the performant editing experience of Pylance in the browser via If you are unfamiliar with, you can head over to any repo, pull request, or file on GitHub and hit ‘.’ on your keyboard (or change the URL to to give it a shot!

We’ve added support for the core editing features you might want when exploring a new codebase or making minor edits to your Python code. These features include:

You can check out Dan Taylor giving a demo on the Python Bytes podcast of this new experience if you’d like!

We’re excited for you to give this new experience a try and welcome any feedback on the Pylance issue tracker.

Although running Python code in the browser isn’t yet supported, you can do so in a Jupyter notebook with the vscode-pyolite extension (in preview), made by one of our team members!

Revamped Testing Interface

We’re excited to announce that we have revamped the look of our Python testing features by utilizing the built-in test explorer in VS Code. You can now enjoy a more stable UI experience for test discovery, navigation and status rendering, as well as new features such as test search, run a selection of tests, rerun last executed test, and more. With this change alone, we have closed 55 issues on our GitHub repo!

Test configuration

Once the Python extension activates, you will see the Test Explorer on the activity bar. If you haven’t configured the testing features, you will see an option to do so on the welcome view:

Configure Python tests button on the test explorer view

Test discovery

Once the testing features are configured, the Python extension attempt to discover tests. Once they’re discovered, you will see your tests listed on the test explorer:

Tests displayed on the test explorer once they are discovered

Tests are now discovered automatically by default whenever you add, delete, or update any python file in the workspace. You can disable that functionality by changing the “python.testing.autoTestDiscoverOnSaveEnabled” setting to “false”.

Test Navigation

You can navigate to test methods or files through the test explorer by clicking on “Go to Test” icon that shows when you hover over or click on a test item. But now you can also navigate to the test on the test explorer from the editor, by right-clicking on the gutter decoration and selecting “Reveal in Test Explorer”.

Navigating to tests from the test explorer and from the editor

Run and debug tests

Although we’ve retired the code lenses, there are still more options for you to run and debug your tests:

The test explorer

By hovering over the test items on the test explorer and clicking on the corresponding icons, as well as through the icons on the top right of the test explorer to run and debug all of the discovered tests. And now you can also run a selection of tests by Ctrl + clicking (or Cmd + Clicking if you’re on macOS) the ones you’d like to run in the explorer, and then clicking on the run icon for one of the tests in the selection:

Running tests through the test explorer

The editor

Although we’ve retired the code lenses, you can still run and debug tests in the editor by clicking on the gutter decorations. You can also right-click on them to debug the tests instead (and you can even change the default behaviour what clicking on the decorators will do to through the “testing.defaultGutterClickAction” setting).

Running tests through the gutter decorations on theeditor

To configure the debugger for tests, you can specify “purpose”: [“debug-test”] in the launch.json file in the .vscode folder from your workspace.

For example, the configuration below in the launch.json file disables the justMyCode setting for debugging tests:

    "name": "Python: Current File",
    "type": "python",
    "request": "launch",
    "program": "${file}",
    "console": "integratedTerminal",
    "justMyCode": false,
    "purpose": ["debug-test"]


We now have new commands that can be particularly helpful when you’re creating or modifying tests. We often want to run the same test method a couple of times when we’re creating it. To make that simpler and more accessible, you can use the “Test: Run Test at Cursor” command to run the method where you have the cursor at in the editor (and you can even add a keyboard shortcut for it so you can more easily do so!). Similarly, you can run the “Test: Rerun last run” command if you want to run the only last test you have executed.

Because we’re leveraging VS Code’s new testing API, a few of our testing commands have changed. If you are used to our old test commands or have key-bindings set up for them, you can reference our documentation to see what the corresponding new commands are.

New button for running and debugging files on the editor

We improved our “run button” on the editor to also include debugging files as an option. When you click on the icon it will run your active Python file in the terminal by default, but you can click on the down-arrow to change the action to debug it instead:

Running and debugging using the new icons on the top right of the editor

You can also customize the action for what the debug icon does by creating a launch.json file and adding “purpose” : [“debug-in-terminal”] to your Python configuration.

For example, the configuration below enables stepping into non-user code when debugging through the debug icon on the editor:

    "name": "Python: Current File - Editor Button",
    "type": "python",
    "request": "launch",
    "program": "${file}",
    "console": "integratedTerminal",
    "justMyCode": false,
    "purpose": ["debug-in-terminal"]

One thing to note is that this will only work for debugging files through the debug icon on the editor – it will not work when starting the debugger through the Run and Debug view or through F5.

Limited IntelliSense support for Python 2.7 starting in October 2021

Our IntelliSense support for Python 2.7 users comes from Jedi 0.17, which came out over a year ago and is the last release of Jedi that supported Python 2.7.  Since that time, we have begun using (and contributing to) jedi-language-server, which puts Jedi behind LSP. This has given Jedi users better performance, refactoring and code navigation capabilities, but is only available for Jedi 0.18.

Starting with the 2021.10 of the Python extension, we will only offer support for Jedi 0.18 and higher, and no longer ship support for Jedi 0.17. We will also be removing support for ctags and rope at the same time.

You can check our wiki page to learn more about the reason behind it and what you can do if you’re still using Python 2.7 in VS Code.

Microsoft Python Language Server end of life November 2021

In the June 2020 release, we announced our team’s investment in Pylance, a new more performant and feature-rich Python language server, and the eventual deprecation of our legacy language server, the Microsoft Python Language Server Since this announcement, our team has worked hard to improve language server support in both Pylance and the open-source language server, Jedi.

With Pylance now as the default language support for Python for Visual Studio Code, almost all of our users have switched to our new language server. As such, the Microsoft Python Language Server will reach end of life with the November release of the Python in Visual Studio Code extension. After deprecation, the Microsoft Python Language Server repository will be marked as archived. This will still allow you to fork and build upon the language server’s codebase if you’d like.

If you are still using this language server (your python.languageServer setting is set to “Microsoft”), you will now see a prompt asking you to choose a new language server – Pylance (recommended; default) or Jedi (open-source). Upon selection, your python.languageServer setting will be appropriately updated in your settings.json to reflect your choice. If at any point you want to try something new, you can do that by updating your settings. If by the November release you have not yet selected a new language server, your language server will automatically flip to the default language support for Python in Visual Studio Code – Pylance.

We’d like to thank all our Microsoft Python Language Server users for their feedback and support over the last couple of years. Your input helped shape what we believe is the best language support for Python in Visual Studio Code ever.

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:

  • Improved display of interpreters list (#16971)
  • Removed support for nose (#16371)
  • Magic cells on Python notebooks no longer cause an error in Pylance (#17058)

And huge thanks to this month’s contributors:

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.

  • Paul Ciobanu 0

    After this update, when I try to run all the tests in my project it takes forever. It seems that it each test is run “individually” – a test suite is created for each test
    If this morning running 40 tests took 3 seconds, now it’s 40+ seconds
    Not sure if related, but there is no ‘Run all tests’ button like the previous version or in the gifs in the post

    • Luciana AbudMicrosoft employee 0

      Hi there! We shipped an update this week with a few bug fixes related to testing. But if you’re still experiencing the same problem, would you mind filing an issue on our GitHub repo so we can investigate it? Thank you!

  • Russell Darst 0

    Hello and thank you for the update!

    I do have a quick question, does this new test discovery feature work with the build in Django test system? The test discovery does not seem to be able to locate my existing tests. If it doesn’t currently support this setup, are the future plans for supporting such a setup?


    • Luciana AbudMicrosoft employee 0

      Hi there! It doesn’t work with Django out of the box, but if you’re using pytest you can set up a pytest.ini file with the proper configuration and it should work. Here’s a sample repo that has it configured to discover tests for a Django app: That said, we do have a feature request to add built-in support for testing with Django – but we don’t have an ETA for it yet. Thanks!

Feedback usabilla icon