Configure Visual Studio Code for Python

The first step is to install the extension needed. The official extension is edited by Microsoft. By typing ‘Python’ in ‘Search’ field, it will be the first one.

Once installed, it should be able to use ‘pylint’ and ‘pep8’ to show errors and autoformat the code on save. Be sure that ‘pylint’ and ‘pep8’ extensions are installed in your virtual environment or the default environment that you’re using in VSC.

I’ve noticed if I launch pylint in Powershell I have not the same warnings/errors as it is in VSC. To be sure the same comments appear in both, it is necessary to uncheck ‘Pylint Use Minimal Checkers’ in the settings.

The last option has to be unchecked.

For ‘pep8’, I noticed that it does not autoformat on save because by default, the ‘Default Formatter’ in the Settings was pointed on ‘null’. Then VSC was not able to pick it up automatically accordingly to the file extension. I so forced it.

Finally, VSC was able to show all problems and to autoformat on save.

Personalize theme

To edit theme in VSC, you need to go to File -> Preferences -> Settings. Then, type ‘theme’ in Searching Bar. You will have to edit the settings.json file in ‘Token Color Customizations’.

If you want to update your personnal parameters, it is in “editor.tokenColorCustomizations”: