Flake8: Your Tool For Style Guide Enforcement

Quickstart

Installation

To installFlake8, open an interactive shell and run:

python<version>-mpipinstallflake8

If you wantFlake8 to be installed for your default Python installation, youcan instead use:

python-mpipinstallflake8

Note

It isvery important to installFlake8 on thecorrect version ofPython for your needs. If you wantFlake8 to properly parse new languagefeatures in Python 3.5 (for example), you need it to be installed on 3.5forFlake8 to understand those features. In many ways, Flake8 is tied tothe version of Python on which it runs.

Using Flake8

To start usingFlake8, open an interactive shell and run:

flake8path/to/code/to/check.py# orflake8path/to/code/

Note

If you have installedFlake8 on a particular version of Python (or onseveral versions), it may be best to instead runpython<version>-mflake8.

If you only want to see the instances of a specific warning or error, you canselect that error like so:

flake8--selectE123,W503path/to/code/

Alternatively, if you want to add a specific warning or error toignore:

flake8--extend-ignoreE203,W234path/to/code/

Please read our user guide for more information about how to use and configureFlake8.

FAQ and Glossary

User Guide

All users ofFlake8 should read this portion of the documentation. Thisprovides examples and documentation aroundFlake8’s assortment of optionsand how to specify them on the command-line or in configuration files.

Plugin Developer Guide

If you’re maintaining a plugin forFlake8 or creating a new one, you shouldread this section of the documentation. It explains how you can write yourplugins and distribute them to others.

Contributor Guide

If you are readingFlake8’s source code for fun or looking to contribute,you should read this portion of the documentation. This is a mix of documentingthe internal-only interfacesFlake8 and documenting reasoning for Flake8’sdesign.

Release Notes and History

General Indices