Comply with PEP8 using flake8 and git pre-commit hooks. It will take just a minute.

>>> import python
Mar 31, 2017 · 1 min read

Go the base location of your source code and activate your virtualenv if any.

$ pip install flake8 # install flake8

If you are using git, create a pre-commit hook file

$ vim .git/hooks/pre-commit

In the file add the below two lines

flake8 .

Now as you try to commit your code it will show you all coding style issues.
You will only be able to commit until code is pep8 compliant.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store