Cognitive Complexity

JSON →
library 1.3.0 ·python
verified May 24, 2026

Cognitive-complexity is a Python library designed to calculate the cognitive complexity of Python functions by analyzing their Abstract Syntax Trees (ASTs). Unlike cyclomatic complexity, cognitive complexity aims to measure how difficult code is for a human to understand, focusing on flow breaks, nesting, and other structures that increase mental effort. The current version is 1.3.0, released in August 2022, with a relatively low release cadence.

total hits 21
actors 6 distinct systems
last hit 1d ago AhrefsBot
MetaBot
4
ByteDance
3
GPTBot
2
Script
2

top countries 🇩🇪 Germany · 🇺🇸 United States · 🇸🇬 Singapore · 🇨🇦 Canada · 🇫🇷 France