Skip to content

Migration to Python Tools Extensions

Luciana Abud edited this page Jul 8, 2023 · 6 revisions

As announced on April 2022, our team has been working towards breaking the tools support we offer in the Python extension for Visual Studio Code 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. This also allows the extensions to be shipped separately from the Python one once a new version of their respective tool becomes available.

Existing Python Tools Extensions

Our team has already shipped Visual Studio Code extensions for the following tools:

These new extensions use the Language Server Protocol to offer linting and/or formatting support, and they all ship with the latest version of each tool.

There are also community contributed extensions available for other Python tools:

Supporting new Python tools extensions

If you don't find your preferred linter in the lists above or in the Marketplace, you can add support for it by creating a new extension via the Python Tools Extension Template. This template allows you to create a Visual Studio Code extension for your favorite Python linter or formatter by changing mostly Python code (unless you’re planning to add more settings or custom logic to it – then you’ll need to work with a bit of TypeScript). You can refer to our documentation to learn more.

Linting and Formatting Settings Deprecation

We are migrating our tooling support to this new extension model. This means that there will no longer be built-in support for linters and formatters, and therefore all the following settings will be removed from the Python extension:

Setting Prefix (JSON) Alternative
python.linting.pylint Use the Pylint extension. Refer to the extension’s README to learn how to configure it.
python.linting.flake8 Use the Flake8 extension.
python.linting.mypy Use the Mypy extension.
python.linting.bandit Use an alternative linter, or check the section below.
python.linting.pydocstyle Use an alternative linter, or check the section below.
python.linting.pycodestyle Use an alternative linter, or check the section below.
python.linting.prospector Use an alternative linter, or check the section below.
python.linting.pylama Use an alternative linter, or check the section below.
python.linting.lintOnSave N/A 
Linting is enabled on type by default when using linter extensions.
python.linting.maxNumberOfProblems Use each extension’s args setting to configure the max number of problems to be shown.
python.linting.cwd Some linter extensions support the cwd setting which you can use instead.
python.linting.ignorePatterns Use each extension’s support for ignorePatterns. You can also upvote these issues: vscode-flake8#147, vscode-pylint#199.
python.linting.enabled You can enable/disable each linter extension separately.
python.formatting.provider Install a formatter extension (such as Black formatter or autopep8).
python.formatting.autopep8 Use the autopep8 extension.
python.formatting.black Use the Black formatter extension.
python.formatting.yapf Use an alternative formatter, or check the section below.

 

Alternatives for deprecated settings

If you are using a tool for which support will no longer exist in the Python extension, these are some alternatives:

  • You can disable auto update of extensions in VS Code and remain using the latest available version that supports the tool you wish to continue to use.

  • You can keep using the tool in the command line, relying on the terminal instead of the Problems view.

  • You can create a task to run the tool automatically in the terminal (for example, on save).

  • Create a VS Code extension for your tool, using our Python tools extension template.

If you’re using Bandit or Pydocstyle, you are able to install plugins and then set of the Flake8 extension’s “flake8.path” setting to point to the plugin binary. For Bandit, install the flake8-bandit plugin. For Pydocstyle, you can install the flake8-pydocstyle plugin.

Clone this wiki locally