mccabe
McCabe checker, plugin for flake8
Decision gist · record as of 2026-08-14
Yes. mccabe is a stable, zero-dependency tool for a well-understood metric (cyclomatic complexity). Install it if you use flake8 and want to enforce complexity limits, or if you need a standalone complexity scanner. The MIT license, active maintenance, and broad Python version support make it a safe, practical addition to code-quality workflows.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.6 or later.
- Low friction: pure Python wheel with no runtime dependencies.
- Actively maintained with recent commits; supports current Python versions (3.6+).
License · maintenance · safety
Expat license (permissive) — MIT (Expat) license permits commercial and private use with minimal restrictions—safe for most projects.
last release 2022-01-24 (1663 days) · last repo commit 2026-06-28 · 681 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 93,922,648 downloads/mo, #364 on PyPI
Alternatives
Verify before relying
pip install mccabe
# Standalone: check complexity of a file
python -m mccabe --min 5 myfile.py
# Or integrate with flake8
flake8 --max-complexity 10 myproject/- Whether the flake8 plugin is automatically discovered or requires explicit configuration beyond --max-complexity.
- Whether the package works with flake8 versions released after 2022-01-24 (the latest release date).
What it is and what it does
mccabe is a cyclomatic complexity checker for Python code. It measures the number of independent paths through a function's control flow—higher complexity indicates more branching and harder-to-test code. The package works as a standalone command-line tool to scan Python files and report functions exceeding a complexity threshold, and also integrates as a plugin into flake8 to flag violations during linting with the C901 error code.
The tool is lightweight, dependency-free, and widely used in code-quality pipelines. It helps teams enforce complexity limits (McCabe's research suggests anything beyond 10 is too complex) and identify functions that may benefit from refactoring. When used with flake8, violations can be silenced on a per-function basis with a `# noqa: C901` comment.
Use it for
- Enforce maximum function complexity in CI/CD pipelines to prevent overly branched code from being merged.
- Identify refactoring candidates in legacy codebases by scanning for functions exceeding a complexity threshold.
- Integrate complexity checks into flake8-based linting workflows alongside other code-quality rules.
- Measure code maintainability metrics as part of technical debt tracking.
- Suppress complexity warnings on specific functions where high complexity is justified with inline `# noqa` comments.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
mccabe is a stable, zero-dependency tool for a well-understood metric (cyclomatic complexity). Install it if you use flake8 and want to enforce complexity limits, or if you need a standalone complexity scanner. The MIT license, active maintenance, and broad Python version support make it a safe, practical addition to code-quality workflows.
Install
mccabe on PyPI
Before you install
Low friction: pure Python wheel with no runtime dependencies. Actively maintained with recent commits; supports current Python versions (3.6+).
Requires Python 3.6 or later.
License in practice
MIT (Expat) license permits commercial and private use with minimal restrictions—safe for most projects.
Quickstart
pip install mccabe
# Standalone: check complexity of a file
python -m mccabe --min 5 myfile.py
# Or integrate with flake8
flake8 --max-complexity 10 myproject/
Verify before relying
- Whether the flake8 plugin is automatically discovered or requires explicit configuration beyond --max-complexity.
- Whether the package works with flake8 versions released after 2022-01-24 (the latest release date).
Package facts
| License | Expat license permissive |
| Python support | Supports the current Python release >=3.6 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 1,663 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 93,922,648 / month, #364 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableEnvironment :: ConsoleIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: Libraries :: Python ModulesTopic :: Software Development :: Quality Assurance |
Evidence: mccabe-0.7.0-py2.py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “cyclomatic complexity checker”
- mccabeMeasures cyclomatic complexity of Python functions and integrates…
- xenonXenon monitors Python code complexity by measuring cyclomatic…
- flake8-cognitive-complexityA flake8 extension that checks Python code for cognitive complexity,…
Give your agent the search over MCP, or paste the wish link into any chat.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also flake8 · flake8-cognitive-complexity · xenon · radon · lizard · complexipy · cognitive-complexity · flake8-expression-complexity · wemake-python-styleguide · flake8-annotations-complexity