A flake8 and Pylama plugin that checks whether Python imports are grouped and ordered according to a chosen style guide.
PyCQA/flake8
A Python linter that wraps PyFlakes, pycodestyle and McCabe into one command, with support for third-party plugins.
- Stars
- 3,833
- Forks
- 364
- Open issues
- 24
- Last commit
- 3 days ago
What is it?
Flake8 checks Python source code for style violations and quality problems. It runs PyFlakes for logical errors such as unused imports, pycodestyle for PEP 8 style issues, and McCabe for code complexity, then merges all results into one per-file report from a single flake8 command.
Beyond combining these tools, Flake8 lets developers suppress warnings selectively. A file-level marker skips a whole file, a trailing noqa comment silences a line, and a noqa comment with specific error codes ignores only those errors. Git and Mercurial hooks are also supported.
Flake8 can be extended through the flake8.extension and flake8.formatting entry points, which allow third-party plugins to add checks and custom output formats.
Key features
- 01Runs PyFlakes, pycodestyle and McCabe together from a single command.
- 02Merges warnings into a per-file, unified output.
- 03Supports file-level and line-level suppression with noqa comments.
- 04Allows suppressing specific error codes on a line.
- 05Provides Git and Mercurial hooks.
- 06Extensible through third-party plugins via entry points.
Use cases
- Enforcing PEP 8 style and catching common bugs in a Python project's CI pipeline.
- Running lint checks as a Git hook before committing code.
- Measuring and flagging overly complex functions with the McCabe checker.
- Writing custom checks or output formats as a Flake8 plugin.
Quick start
- 1
Follow the quickstart documentation linked in the README to install and run Flake8
Things to know
- The license is not clearly identified in the project metadata.
In collections
Topics
FAQ
- What is flake8?
- A Python linter that wraps PyFlakes, pycodestyle and McCabe into one command, with support for third-party plugins. Flake8 checks Python source code for style violations and quality problems. It runs PyFlakes for logical errors such as unused imports, pycodestyle for PEP 8 style issues, and McCabe for code complexity, then merges all results into one per-file report from a single flake8 command.
- Is flake8 free to use? What license does it have?
- flake8 is open source under the Other license. Check the license terms before using it in commercial products.
- Is flake8 still maintained?
- Actively maintained. The last commit to flake8 was on Nov 4, 2026.
- What can I use flake8 for?
- Enforcing PEP 8 style and catching common bugs in a Python project's CI pipeline. Running lint checks as a Git hook before committing code. Measuring and flagging overly complex functions with the McCabe checker. Writing custom checks or output formats as a Flake8 plugin.
- How do I install flake8?
- Follow the quickstart documentation linked in the README to install and run Flake8
- Where can I get flake8?
- The source code and installation instructions are on GitHub: https://github.com/PyCQA/flake8
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
An extremely fast Python linter and code formatter written in Rust, with over 900 lint rules and Black-compatible formatting.
A single-file Python checker that tests code against the style conventions of PEP 8, using only the standard library.
A Python tool that computes McCabe cyclomatic complexity for functions and runs as a flake8 plugin to flag overly complex code.
A Flake8 plugin that flags likely bugs and questionable design patterns that pyflakes and pycodestyle don't check.
A strict, opinionated flake8 plugin that enforces consistent, simple Python code style and flags complex code patterns.