What is Flake8 and why we should use it?

Itech Gal
Itech Gal
Jan 30, 2017 · 2 min read

Recently I was thinking about tools that make 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 a basic quality tool against your code. The tool will check your code syntax and provide instructions on how to clean it.

Why “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 of 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 a low rate of false positives.

Flake8 is easy to setup:

Just run :

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

Supported by Python2+:


Python 3+:

Flake8 usage:

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

You can run

for help instructions

Run in your:


Cool features:

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

For example:

To ignore warnings you can do :

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 a 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

Python Pandemonium

A place to read and write about all things Python.

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