command line - Python linter and code formatter recommendations - Software Recommendations Stack Exchange
Python Lints Suggestions
visual studio code - Real-time linting of Python with VSCode - Stack Overflow
Python linter and tests - Developers - Klipper
Videos
I use black & isort for code formatting and flake8 for style checking and linting. Pylint is a great addition too, it's stricter and provides detailed feedback - great for improved code quality over time.
Ruff is a modern Python linter and formatter.
Its main highlight is the speed, which claims to be up to 100x faster than the other alternatives.
Ruff ships with a built-in language server, that enables it to be used in any editor that supports the LSP (Neovim, Emcas, Sublime, etc).
There is also a dedicated VS Code extension.
Also it has a pre-commit hook from the authors: https://github.com/astral-sh/ruff-pre-commit
EDIT4, 14 Apr 2024
Enable format on save option in UI setting globally.
EDIT3, 13 Apr 2024 Its just enough for 1.88.1 version
{
"editor.formatOnSave": true
}
EDIT2, 27 Mar 2024
Just only use this config to real time linting.
{
"python.defaultInterpreterPath": "/usr/bin/python3",
"editor.formatOnSave": true
}
Installed extensions are
- python
- pylint
- pylance
- python debugger
- autopep8
EDIT1
Update 4 Jul 2022
New version of python extension deprecates "python.pythonPath" and suggest to use this instead.
"python.defaultInterpreterPath": "/usr/bin/python3",
Put these lines in .vscode/settings.json
{
"python.linting.pylintEnabled": true,
"python.linting.enabled": true,
"python.pythonPath": "/usr/bin/python3",
"editor.formatOnSave": true
}
And install autopep8 package.
Use pip to install it
python3 -m pip install autopep8
Or in Debian based as python3-autopep8 exists in repo you can run
sudo apt install python3-autopep8
And then python linting on vscode will work.
Also, the Warning menu will activate.
Hint that I set run linter onsave.

If you use shift + cmd + P (or ^+ctrl+P for windows) or go to View > Command Palette and type "Lint"
The Command Palette allows you to execute different commands, from here you can enable/disable Linting and select which Linter you would like to use. Most popular is PyLint but you can select Flake8 or Pep8 or whatever you like.
I believe you need to do these things before the linter works in real-time.
To scan for problems with your code without saving first, use shift + cmd + M, you will receive an error code in the vscode Terminal.