- Notifications
You must be signed in to change notification settings - Fork1.2k
Migration to Python Tools Extensions
Asannounced 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.
Our team has already shipped Visual Studio Code extensions for the following tools:
These new extensions use theLanguage 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:
If you don't find your preferred linter in the lists above or in theMarketplace, you can add support for it by creating a new extension via thePython 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 ourdocumentation to learn more.
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 thePylint extension. Refer to the extension’s README to learn how to configure it. |
python.linting.flake8 | Use theFlake8 extension. |
python.linting.mypy | Use theMypy extension. |
python.linting.bandit | Use an alternative linter, orcheck the section below. |
python.linting.pydocstyle | Use an alternative linter, orcheck the section below. |
python.linting.pycodestyle | Use an alternative linter, orcheck the section below. |
python.linting.prospector | Use an alternative linter, orcheck the section below. |
python.linting.pylama | Use an alternative linter, orcheck 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 asBlack formatter orautopep8). |
python.formatting.autopep8 | Use theautopep8 extension. |
python.formatting.black | Use theBlack formatter extension. |
python.formatting.yapf | Use theyapf extension. |
If you are using a tool for which support will no longer exist in the Python extension, these are some alternatives:
You can try theRuff extension. Ruff has support for various linters such asflake8-bandit,pycodestyle,pydocstyle,Pyflakes,mccabe, and more.
Youcan 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 atask to run the tool automatically in the terminal (for example, on save).
Create a VS Code extension for your tool, using ourPython tools extension template.