Setting Up PEP8 and Pylint on VS Code

Formatting Python Code to pass the Maintainability test can be hard; especially if you are not receiving some help. It’s in human nature to get tired of redundancy, we easily want to get the job done quickly and move on. However, this affects our work output and the quality of our work. When it comes to code quality it’s paramount to maintain standards, there’s no better way to do so than to follow some already set standards.

PEP8 defines Python coding standards; from variable declaration to formatting of classes. It has it all, this allows you to nicely format your python code. To install the package ensure you are in your project folder and is enabled, if not run the following lines in your folder directory

Then install PEP8

Now let’s checkout Pylint, this tool checks whether we follow PEP8 standards and returns errors where we fail to follow. Furthermore, this tool also does error checking due to syntax errors. To install pylint run the following code;

Since we now have the two needed tools we can now open vs code

Once we open our vs code editor; we can select our preferred interpreter, just press .

You should see something similar to the above result. Next we select our Python Interpreter

Just select the python3/2 with virtualenv enabled. This will ensure that Vs code picks up tools we installed in virtual env.

Next, we finally activate linting on Vs code. Follow the following steps Click

Your workspace should match the above linting settings. After editing your json save the settings and start coding. Now every time you access Vs Code in virtaulenv it will always activate linting.

McKinley & Rice

Welcome to Magazine Seminal, the mouthpiece of McKinley & Rice. Discussions about tech, design, startups, and investments (especially in emerging economies). Don’t forget to visit us at our official Vlog Channel on YouTube too.

Hemprasad Badgujar

Written by

McKinley & Rice

Welcome to Magazine Seminal, the mouthpiece of McKinley & Rice. Discussions about tech, design, startups, and investments (especially in emerging economies). Don’t forget to visit us at our official Vlog Channel on YouTube too.