Linters
What is Pyflakes? An introduction to PyCQA's Python source file checker
Pyflakes is a simple program that checks Python source files for errors. It parses source files instead of importing them, which makes it safe on modules with side effects and faster. It never complains about style and tries hard to avoid false positives.
- Tool
- Pyflakes
- Made by
- PyCQA
- Official site
- github.com/PyCQA/pyflakes
- Category
- Linters
Who makes Pyflakes
Pyflakes is maintained under PyCQA. Its official website is the project's GitHub repository, linked below.
The project accepts patches via GitHub pull requests.
Official website: github.com/PyCQA/pyflakes
What Pyflakes is for
Pyflakes is for checking Python source files for errors. Instead of importing a file, it parses it. That means it is safe to run on modules with side effects, and it is faster.
It does not report style problems, and it tries hard to avoid false positives. The aim is for what it does report to be worth reading.
Who Pyflakes is for
Pyflakes is for Python developers. It is available on PyPI and supports all active Python versions (3.9+).
To check code against a specific Python version, you can run it with python#.# -m pyflakes.
Developers who want style checks as well can use Flake8, which combines Pyflakes with PEP 8 style checks and per-project configuration.
Notable capabilities
Pyflakes is deliberately narrow. Its capabilities mostly describe how it analyzes code and what it chooses not to do.
The list below comes from the project's own description.
- No imports: it parses source files instead of importing them, so it is safe on modules with side effects.
- Speed: it is faster than Pylint because it examines each file's syntax tree individually.
- No style complaints: it never complains about style.
- Low false positives: it tries hard to avoid false positives.
- Version targeting: it can be run for a specific Python version with python#.# -m pyflakes.
- Python version support: it is available on PyPI and supports all active Python versions (3.9+).
How Pyflakes fits linters
Pyflakes is a linter that concentrates on errors rather than style. Because it analyzes each file individually, it is limited in the kinds of checks it can do. That is the trade-off for its speed and its safety on modules with side effects.
For readers of Linthelm, which covers linters, static analysis and code quality tools, Pyflakes is a minimal building block. It is often used through Flake8, which adds PEP 8 style checks and per-project configuration. Contributions to the project must include tests and pass flake8.
Frequently asked questions
What is Pyflakes used for?
Pyflakes is used to check Python source files for errors. It parses files instead of importing them, so it is safe on modules with side effects.
Who develops Pyflakes?
Pyflakes is maintained under PyCQA. Patches are accepted via GitHub pull requests, and changes must include tests and pass flake8.
Does Pyflakes check code style?
No. Pyflakes never complains about style. Flake8 combines Pyflakes with PEP 8 style checks and per-project configuration.
Which Python versions does Pyflakes support?
It supports all active Python versions (3.9+) and is available on PyPI. You can run it for a specific version with python#.# -m pyflakes.
Is Pyflakes faster than Pylint?
Pyflakes is faster than Pylint because it examines each file's syntax tree individually. The trade-off is that it is limited in the kinds of checks it can do.
Linthelm is independent and is not affiliated with PyCQA. Product names belong to their owners. Features change; confirm details on the official website.