skillfed

mccabe

McCabe checker, plugin for flake8

mccabe Permissive license Expat license Active 681 v0.7.0 released

Install

mccabe on PyPI

pip

pip install mccabe

uv

uv add mccabe

poetry

poetry add mccabe

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,662 days since the last release
Last repo commit
First released
Popularity one of the top 1,000 most-downloaded packages on PyPI (30-day window, as of 2026-08-13)
Known vulnerabilities none known (OSV.dev, checked 2026-08-13)

Evidence: mccabe-0.7.0-py2.py3-none-any.whl

Keywords: flake8, mccabe

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

About mccabe

from the package's own PyPI description — quoted content, verbatim

McCabe complexity checker

Ned's script to check McCabe complexity.

This module provides a plugin for flake8, the Python code checker.

Installation

You can install, upgrade, or uninstall mccabe with these commands::

$ pip install mccabe $ pip install --upgrade mccabe $ pip uninstall mccabe

Standalone script

The complexity checker can be used directly::

$ python -m mccabe --min 5 mccabe.py ("185:1: 'PathGraphingAstVisitor.visitIf'", 5) ("71:1: 'PathGraph.to_dot'", 5) ("245:1: 'McCabeChecker.run'", 5) ("283:1: 'main'", 7) ("203:1: 'PathGraphingAstVisitor.visitTryExcept'", 5) ("257:1: 'get_code_complexity'", 5)

Plugin for Flake8

When both flake8 2+ and mccabe are installed, the plugin is available in flake8::

$ flake8 --version 2.0 (pep8: 1.4.2, pyflakes: 0.6.1, mccabe: 0.2)

By default the plugin is disabled. Use the --max-complexity switch to enable it. It will emit a warning if the McCabe complexity of a function is higher than the provided value::

$ flake8 --max-complexity 10 coolproject
...
coolproject/mod.py:1204:1: C901...

Read as markdown · JSON record · Source repository · Homepage

AI interpretation — verify before relying

AI-generated interpretation of the package facts above; every digit, version, license, or vulnerability id it cites is grounded in the facts already shown on this page

Measures cyclomatic complexity of Python functions to identify overly complex code; works as a standalone checker or integrates with flake8 to flag functions exceeding a complexity threshold.

Installs cleanly with no runtime dependencies and maintains active development; last release was 2022-01-24 with Python 3.6+ support confirmed.

Licensed under the Expat license (MIT equivalent), a permissive license allowing commercial and private use with minimal restrictions.

Usage

pip install mccabe
python -m mccabe --min 5 yourfile.py

Or integrate with flake8:
flake8 --max-complexity 10 yourproject/

Requires Python 3.6 or later; flake8 integration requires flake8 2.0+ to be installed separately.

Verdict: A mature, actively maintained tool for detecting overly complex functions in Python code. Zero known vulnerabilities, permissive licensing, and zero runtime dependencies make it a low-friction addition to code-quality workflows. Best used as a flake8 plugin or standalone checker to enforce complexity thresholds across a codebase.

Needs verification

  • Whether the flake8 plugin is automatically discovered or requires explicit configuration beyond --max-complexity
  • Current adoption rate or download volume relative to other flake8 plugins
cyclomatic complexity checkercode complexity analysis pythonflake8 complexity pluginmccabe complexityfunction complexity measurementdetect complex functionscode quality metrics python

Similar packages