Python in Visual Studio Code – April 2022 Release

kanadig

The April 2022 release of the Python Extension for Visual Studio Code is now available.

In this release we’re introducing the following changes:

  • Pylint extension
  • Interpreter display in the status bar moved to the right
  • Simpler way to create empty Python and Jupyter Notebook files
  • Fix for running and debugging files with conda environments

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

Pylint extension

Our team is working towards breaking the tools support we offer in the Python extension into separate extensions, with the intent of improving performance, stability and no longer requiring the tools to be installed in a Python environment – as they can be shipped alongside an extension. The first one we started to work on is Pylint.

This new extension uses the Language Server Protocol to provide linting support, and it ships with the latest version of pylint.Pylint errors and warnings being displayed on Python code in Visual Studio Code.

It also provides additional ways to configure the severity levels of the issues reported via pylint. For example:

“pylint.severity” : {
    "convention": "Information",
    "error": "Error",
    "fatal": "Error",
    "refactor": "Hint",
    "warning": "Warning",
    "info": "Information",
    "W0611": "Error", //per error code
    "unused-import": "Error" //per error diagnostic
}

Note: You may see two entries for the same problem in the Problems panel if you also have Pylint enabled in the Python extension. You can disable the built-in linting functionality by setting “python.linting.pylintEnabled”: false.

You can try this new extension out today by installing it from the marketplace. If you have any issues or feature requests, you can file them at the Pylint extension’s GitHub repository.

Interpreter display in the status bar moved to the right

To be more consistent with other extensions in VS Code, we moved the selected interpreter version display towards the right side in the status bar, next to the language status item Python. It is now only displayed when a Python or a settings.json file is currently open, to avoid cluttering the status bar:

Interpreter information displayed on the bottom-right of the editor, on the status bar.

Simpler way to create empty Python and Jupyter Notebook files

You can now create empty Python or Jupyter notebook files by running the “File: Create New…” command in the command palette, or by clicking on “New File…”  from VS Code’s welcome page:

Clicking on "new file..." from VS Code's welcome page and selecting "Python" and "Notebook"

Fix for running and debugging files with conda environments

In the February 2022 release, we made some improvements to the experience when using Anaconda environments, which caused a regression when running files in activated conda environments. These issues are now fixed in this release.

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:

  • Add support for detection and selection of conda environments lacking a python interpreter. When selecting such environment, the Python extension will automatically install a Python interpreter. (vscode-python#18357)
  • Improved Kernel support when using .env files. (vscode-jupyter#9127)
  • Support Kernel installation for more conda environments. (vscode-jupyter#9133)
  • Add support for named index in dataframe viewer for DataFrames and Series. (vscode-jupyter#5348)
  • Support symbol rename on untitled Python files. (pylance-release#2468)
  • Better indication when renaming symbols (F2) isn’t supported. (pylance-release#441)
  • debugpy updated to version v1.6.0. In this new version, Python 2.7 and Python 3.6 are no longer supported. (vscode-python#18795)

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

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.

0 comments

Discussion is closed.

Feedback usabilla icon