What’s New in Python in Visual Studio Code’s December 2022 Release?

A Visual Studio Code window containing some code

Improvements to Python extensions for Visual Studio Code have been rolled out.

Microsoft announced on its dev blogs website that the December 2022 release of the Python extensions for Visual Studio Code is now available! These extensions are in the pre-release stage but are available for the public to try out. Here’s what this December 2022 release has to offer.

1. Auto Indentation With Pylance

Pylance pre-release in Visual Studio Code-Insiders

There has been the addition of an auto-indent feature in the Pylance extension. This feature automatically creates the correct indentations in your code. This allows programmers to allocate more of their time to the logic part of their code and less time to formatting. You can give it a try in VS Code – Insiders (registration required).

After installing VS Code Insiders, go to the marketplace and install the Pylance extension. Navigate to View > Command Palette, type Preferences, and run Open User Settings (JSON). Make sure the editor.formatOnType is set to true. It controls whether the editor will automatically format a line of code after typing.

Process of opening User Settings (JSON)

    "workbench.colorTheme": "Default Dark+",
    "[python]": {
        "editor.formatOnType": true
    "python.defaultInterpreterPath": "C:\\New folder\\python.exe"

Once set to true go ahead and write your code to enjoy this new feature.

2. Python for the Web Extension

Experimental-Python for the web extension in Visual Studio Code- Insiders

This is a new VS Code extension that allows you to run and debug Python code in the browser. It uses WebAssembly as the execution engine. It is in the experimental stage and hence you should not use it for Python production development. To start using it, follow the following steps:

  1. Open a Chrome-based browser.
  2. Navigate to your GitHub repository using the following address. https://insiders.vscode.dev/github/{username}/{repo}?vscode-coi=. Substitute the username and repo part with your GitHub username and repository respectively. The output should be as shown below.
    python for the Web browser launch page image

  3. Go to the marketplace and install the Experimental – Python for the Web extension.
  4. Open your Python file.
  5. Press F5 to start debugging or CTRL+F5 to run the code without debugging.

Limitations of the Python for the Web Extension

As noted, the Python for the Web extension is experimental, and as such has some limitations.

  1. Most Intellisense plugins and extensions are not available for use in Python for the web. The unavailable ones are indicated by a caution symbol as shown below.
    List of some of the unavailable extensions and plugins for the Python for the web extension

  2. The Python interpreter that the web version uses has the following limitations.
    • It does not support pip
    • It does not support socket
    • It does not support native Python modules
    • No thread support hence no async support either.

Consequently, your use of this feature should be limited to prototype projects and test environments.

3. The Ruff Extension

Ruff extension in Visual Studio Code-Insiders

This extension provides support for the Ruff linter. The most amazing feature is that it provides Quick Fix actions which will automatically correct auto-fixable violations. The Ruff extension does not require you to use the VS Code insiders to try it. It is also available for installation in the normal VS Code. To give it a try, navigate to the VS Code marketplace and install it.

It fixes the violations in the code by running on your code when you edit or open a Python file. To use it, follow the following steps:

  1. Open Visual Studio Code
  2. Create a new Python file and write your code
  3. If you have a previously saved Python source file, open it in Visual Studio Code
  4. Run the Ruff extension by navigating to View > Command Palette, type Ruff, and run Ruff: Fix all auto-fixable problems as shown below.
    process of applying Ruff extension Fix all auto-fixable problems

  5. Once run, Ruff will fix all the auto-fixable violations in your Python code.

Why You Should Try the New Python Extensions in Visual Studio Code

The addition of new features to Visual Studio Code extensions has made developing in Python more efficient on the platform. You will take less time worrying about code formatting and hence spend more time working on the logic of your code.

Moreover, open-source IDEs like Visual Studio Code get feature updates regularly. This is due to the large number of people involved in IDE development. The updates come with new functionalities which lead to a better coding experience while using the IDEs.

Leave a Reply
Previous Article
Abstract Light Quantum Physics

Dawn of Solid-State Quantum Networks – The Holy Grail of Quantum Information Sciences

Next Article
How To Do a Seated Straddle Raise

How To Do a Seated Straddle Raise

Related Posts