What is Flake8 and why we should use it?

Recently I was thinking about tools that makes me a better Python Developer. Among much useful and good once I’ve decided to start from one which makes daily routine easier. I’m going to share what linting is, how to use it, and how to incorporate it into your automated build.

What is Lint?

In computer programming lint or lint-like tools performing static analysis of source code checking for symantec discrepancies.

What is “Linting”?

“Linting” means running basic quality tool against your code. The tool will check your code syntax and provide instructions how to clean it.

Is “linting” important and why should we use it?

Well… I think it is very important. The one simple reason: linting helps to prevent bugs in your program. In other words:

  • Linting makes you a better developer by helping write a better code (checking against coding standards)
  • Helps prevent things like syntax errors, typos, bad formatting, incorrect styling, etc
  • Saves our time as a developer
  • If you working in the team, it saves time for people who are reviewing your code (no need to distrust for typos and formatting issues)
  • It is easy to use
  • Lint-like tools usually very easy to setup
  • It is free :)

In short, code linters are awesome!

What is Flake8?

There are a couple good python code linter tools you can use. The one I’ve recently discovered is a Flake8. Which is “the wrapper which verifies pep8, pyflakes and circular complexity “. It has low rate of false positives.

Flake8 is easy to setup:

Just run :

python<version> -m pip install flake8

You can easily add it to the python IDE or editor of your choice ( e.g.: PyCharm, SublimeText, etc).

Supported by Python2+:

python2.7 -m flake8


Python 3+:

python3.5 -m flake8

Flake8 usage:

Flake8 runs all the tools by launching the single flake8 command.

You can run

flake8 — help

for help instructions

Run in your:

flake8 path/to/your_code/main.py #check particular file


flake8 path/to/your_project/ #check the entire project repo

Cool features:

One of the useful features I found is the flag to run Flake8 only for specific type of warnings, errors, etc.

For example:

flake8 — select W54 path/to/your_project/

To ignore warnings you can do :

flake8 — ignore W54 path/to/your_project/

After trying flake8 multiple times you’re realizing that some set of commands with Flake8 are the same. Good thing Flake8 supports creating and storing configuration file. You can change the Flake8 settings globally by editing its config file. The user configuration file is expected to be stored somewhere in the user’s “home” directory. Which will read from the ~/.config/flake8 file (~/.flake8 for Windows)

Configure Flake8 with:




Other good linting tools I’ve used before:

Linter is useful tool, so just go and try it yourself. I can assure you will learn more and it will make you better Python Programmer with less stress and more time :)

Looking for more details:

Documentation is here

Want to contribute:

Just click on this link for more details

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.