flake8-builtins
Check for python builtins being used as variables or parameters
What it is and what it does
flake8-builtins is a flake8 plugin that catches a common Python mistake: shadowing built-in names (like `list`, `dict`, `max`, `zip`) with your own variables, function parameters, class attributes, or imports. When you shadow a builtin, you lose access to it in that scope, which can cause cryptic TypeErrors or other runtime failures. The plugin runs as part of your flake8 linting workflow and reports six categories of violations (A001–A006) for different kinds of shadowing.
It works by integrating into flake8's AST visitor and checking each name binding against Python's builtins. You can customize which builtins to ignore via the --builtins-ignorelist option if you have a legitimate reason to shadow a specific builtin. The plugin supports Python 3.10, 3.11, 3.12, 3.13, 3.14, and PyPy3.
Use it for:
- Catch accidental shadowing of builtins like `list` or `dict` in function parameters before they cause runtime errors.
- Enforce a team code-style rule that forbids shadowing builtins to keep code predictable and maintainable.
- Integrate into CI/CD pipelines to reject pull requests that introduce builtin shadowing violations.
- Audit legacy codebases for places where builtins have been shadowed and need refactoring.
- Whitelist specific builtins you intentionally shadow (e.g., `id` or `copyright`) via configuration.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
A flake8 plugin that detects when Python builtins are shadowed by variables, parameters, class attributes, imports, or lambda arguments in your code.
Yes, if you use flake8 and want to prevent a class of subtle bugs. The plugin is lightweight, has no external dependencies beyond flake8, and catches real mistakes that can break code at runtime. Maintenance is aging but the package is stable and widely used (nearly 1 million monthly downloads). No known security vulnerabilities.
Install
flake8-builtins on PyPI
pip
pip install flake8-builtinsuv
uv add flake8-builtinspoetry
poetry add flake8-builtinsInstalling flake8-builtins
Before you install
Installs with minimal friction—a pure Python wheel with only flake8 as a runtime dependency. Maintenance status is aging (last release 293 days ago), but the repository remains active and the package is marked Production/Stable.
License in practice
Licensed under GPLv2 (copyleft). If you distribute code that uses this plugin, you must make your modifications available under the same license; this applies primarily to derivative works of the plugin itself, not to code you lint with it.
Quickstart
pip install flake8-builtins
flake8 --builtins-ignorelist id,copyright myfile.py
Verify before relying
- Whether the plugin is actively maintained or in maintenance-only mode given the 293-day gap since last release.
- Whether the --builtins-ignorelist option works as documented in current versions.
Package facts
| License | GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and… (full text in the JSON record) (copyleft) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — flake8 |
| Maintenance | aging — 293 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 989,868/month — #4,565 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: flake8_builtins-3.1.0-py3-none-any.whl
Keywords: flake8, pep8, python
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
flake8-variables-namesA flake8 extension that detects poorly named…
permissive · top 15,000 on PyPI
flake8-deprecatedA flake8 plugin that detects calls to…
copyleft · top 15,000 on PyPI
flake8-unused-argumentsA flake8 plugin that detects unused function…
permissive · top 15,000 on PyPI
dlintDlint is a flake8 plugin that adds…
permissive · top 15,000 on PyPI
flake8-annotationsA Flake8 plugin that enforces PEP 3107-style…
permissive · top 15,000 on PyPI
flake8-functionsA flake8 extension that enforces function-level…
permissive · top 15,000 on PyPI
flake8-printA flake8 plugin that detects print statements…
permissive · top 5,000 on PyPI
flake8-annotations-complexityA flake8 plugin that flags type annotations…
permissive · top 15,000 on PyPI
flake8Flake8 is a command-line tool that combines…
permissive · top 1,000 on PyPI
wemake-python-styleguideA flake8 plugin that enforces strict,…
permissive · top 15,000 on PyPI