A static code analyser for Python that checks for errors, enforces coding standards, and flags code smells without running your code.
PyCQA/pyflakes
A Python linter that checks source files for errors by parsing code without importing it, avoiding style checks.
Open-source alternative to:Pylint
- Stars
- 1,465
- Forks
- 205
- Open issues
- 59
- Last commit
- 9 days ago
What is it?
Pyflakes checks Python source files for errors such as unused imports, undefined names and other mistakes it can detect from the syntax tree. It parses each file rather than importing it, so it is safe to run on modules with side effects, and it runs faster than Pylint.
Its design goal is to stay quiet rather than noisy: it does not report style issues and tries hard to avoid false positives. Because it looks at each file individually, it can check fewer kinds of problems than tools that analyze a whole project.
Pyflakes is installed from PyPI and supports Python 3.9 and later. It can be run as a command or as a module for a specific Python version. For style checks as well, the project points to flake8, which combines Pyflakes with PEP 8 checks.
Key features
- 01Detects errors such as unused imports and undefined names by parsing source code.
- 02Does not import the checked code, so it is safe for modules with side effects.
- 03Avoids style complaints and aims to minimize false positives.
- 04Runs faster than Pylint because it analyzes each file's syntax tree alone.
- 05Installable from PyPI and runnable for a specific Python version.
Use cases
- Catching simple mistakes in Python code before running tests.
- Adding a fast, low-noise lint step to a CI pipeline.
- Checking modules that have import-time side effects without executing them.
- Pairing with flake8 when style checks are also wanted.
Quick start
- 1
Install Pyflakes from PyPI
pip install --upgrade pyflakes - 2
Run Pyflakes on the current directory
python -m pyflakes .
Things to know
- It only reports errors and does not perform style checks, so use flake8 if you also want PEP 8 checks.
In collections
Topics
FAQ
- What is pyflakes?
- A Python linter that checks source files for errors by parsing code without importing it, avoiding style checks. Pyflakes checks Python source files for errors such as unused imports, undefined names and other mistakes it can detect from the syntax tree. It parses each file rather than importing it, so it is safe to run on modules with side effects, and it runs faster than Pylint.
- Is pyflakes free to use? What license does it have?
- pyflakes is open source under the MIT license. Check the license terms before using it in commercial products.
- Is pyflakes still maintained?
- Actively maintained. The last commit to pyflakes was on Oct 28, 2026.
- What can I use pyflakes for?
- Catching simple mistakes in Python code before running tests. Adding a fast, low-noise lint step to a CI pipeline. Checking modules that have import-time side effects without executing them. Pairing with flake8 when style checks are also wanted.
- How do I install pyflakes?
- Install Pyflakes from PyPI: pip install --upgrade pyflakes Run Pyflakes on the current directory: python -m pyflakes .
- Where can I get pyflakes?
- The source code and installation instructions are on GitHub: https://github.com/PyCQA/pyflakes
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A strict, opinionated flake8 plugin that enforces consistent, simple Python code style and flags complex code patterns.
A linter that enforces Swift style and conventions, with over 200 rules that can be configured per project.
A Java static analysis tool that checks source code against a coding standard, configurable via XML and run from the command line, Ant, or Maven.
Static code analysis tool for Kotlin projects that flags code smells and style issues, configurable via rule sets and a Gradle plugin.
A single-file Python checker that tests code against the style conventions of PEP 8, using only the standard library.