flake8-bugbear
A plugin for flake8 finding likely bugs and design problems in your program. Contains warnings that don't belong in pyflakes and pycodestyle.
What it is and what it does
flake8-bugbear is a flake8 plugin that extends Python linting with opinionated checks for bugs and design antipatterns. It fills a gap between the core linters (pyflakes and pycodestyle) and more comprehensive tools by focusing on patterns that are genuinely problematic but too specific or debatable for the main Python tooling. The plugin runs automatically once installed and integrated with flake8, adding warnings like B001 (bare except clauses), B006 (mutable default arguments), B008 (function calls in defaults), and many others that catch real mistakes developers commonly make.
The package depends on flake8 and attrs, both widely used and stable. It supports current Python versions (3.10 through 3.14) and has been actively maintained since 2016. With no known security vulnerabilities and a permissive MIT license, it is designed to be deployed flexibly across different projects and environments. The plugin's opinionated nature is intentional—rules live here precisely because they do not belong in standardized tools, giving teams the choice to adopt them or not.
Use it for:
- Catch bare except clauses and other exception-handling mistakes that can mask serious bugs.
- Detect mutable default arguments and function calls in defaults that cause subtle state-sharing bugs.
- Flag redundant exception types in except blocks and other code patterns that waste CPU or cause confusion.
- Identify loop control variables that override iterables or are unused, catching common loop mistakes.
- Enforce better practices in abstract base classes and context managers.
- Integrate into CI/CD pipelines to enforce consistent code quality standards across a team.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
A flake8 plugin that detects likely bugs and design problems in Python code through opinionated linting rules not covered by pyflakes or pycodestyle.
Yes. flake8-bugbear is worth installing if you use flake8 and want to catch real bugs and design problems that the standard linters miss. It has low install friction, active maintenance, no security issues, and a permissive license. The only caveat is that its rules are opinionated—review the warning list to confirm they align with your team's coding standards before adopting it widely.
Install
flake8-bugbear on PyPI
pip
pip install flake8-bugbearuv
uv add flake8-bugbearpoetry
poetry add flake8-bugbearInstalling flake8-bugbear
Before you install
Installs with minimal friction—a pure-Python wheel with only flake8 and attrs as runtime dependencies. Actively maintained with a recent release and steady commit activity.
License in practice
MIT license permits unrestricted use, modification, and distribution in both open and proprietary projects with only attribution required.
Quickstart
pip install flake8-bugbear
flake8 your_code.py
# Automatically integrated into flake8; check detection with:
flake8 --version
Requires Python 3.10 or later and flake8 to be installed.
Verify before relying
- Specific count and scope of all warning rules beyond the B001–B027 examples shown in the description excerpt.
- Performance impact on large codebases or CI/CD pipelines.
- Configurability and rule-suppression mechanisms beyond standard flake8 configuration.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — flake8, attrs |
| Maintenance | actively maintained — 258 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 5,041,661/month — #2,177 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: flake8_bugbear-25.11.29-py3-none-any.whl
Keywords: flake8, bugbear, bugs, pyflakes, pylint, linter, qa
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
flake8Flake8 is a command-line tool that combines…
permissive · top 1,000 on PyPI
flake8-mutableA flake8 plugin that detects mutable default…
permissive · top 15,000 on PyPI
flake8-pyiA Flake8 plugin that lints Python type stub…
permissive · top 5,000 on PyPI
flake8-banditIntegrates bandit security checks into flake8…
permissive · top 15,000 on PyPI
flake8-comprehensionsA flake8 plugin that detects and suggests…
permissive · top 5,000 on PyPI
flake8-blind-exceptA flake8 plugin that detects overly broad…
permissive · top 15,000 on PyPI
flake8-tupleA flake8 plugin that detects unintended…
permissive · top 15,000 on PyPI
pyflakesPyflakes checks Python source files for logical…
permissive · top 1,000 on PyPI
flake8-printA flake8 plugin that detects print statements…
permissive · top 5,000 on PyPI
flake8-debuggerA flake8 plugin that detects debugger…
permissive · top 15,000 on PyPI