complexipy
An extremely fast Python library to calculate the cognitive complexity of Python files, written in Rust.
Decision gist · record as of 2026-08-14
Yes. complexipy is actively maintained, has no known vulnerabilities, uses a permissive MIT license, and fills a genuine need for cognitive complexity analysis in Python. The Rust backend and broad platform support (wheels for cp310, cp311, multiple architectures) reduce friction. It's suitable for teams wanting to measure and enforce code readability beyond traditional cyclomatic metrics.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Medium install friction due to compiled wheels across multiple platforms (cp310, cp311, and various architectures).
- Active maintenance with recent release (2 days old) and 761 repository stars indicate solid ongoing support.
License · maintenance · safety
MIT (permissive) — MIT license is permissive; you can use, modify, and distribute complexipy with minimal restrictions, making it suitable for both open-source and commercial projects.
last release 2026-08-12 (2 days) · last repo commit 2026-08-12 · 761 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 610,329 downloads/mo, #5,767 on PyPI
Alternatives
Verify before relying
pip install complexipy
from complexipy import file_complexity
result = file_complexity("app.py")
print(f"File complexity: {result.complexity}")
for func in result.functions:
print(f"{func.name}: {func.complexity}")- Whether the Rust implementation provides measurable performance gains over pure-Python alternatives in typical workflows
- How cognitive complexity scores correlate with actual maintenance burden or bug rates in practice
What it is and what it does
complexipy is a Python library that measures cognitive complexity—how hard code is to understand for humans—by analyzing nesting depth, control flow patterns, and code structure. Unlike cyclomatic complexity, which counts branches, cognitive complexity penalizes nested logic and human-unfriendly patterns to reflect actual readability challenges. The library is written in Rust for speed and provides both a command-line tool and a Python API.
You can use it to analyze individual files or entire codebases, set complexity thresholds, generate reports in multiple formats (JSON, CSV, SARIF, GitLab), compare complexity across git references, and integrate into CI/CD pipelines. It supports configuration via TOML files and includes pre-commit hooks, GitHub Actions, and VS Code integration.
Use it for
- Enforce code quality standards in CI/CD by failing builds when functions exceed a complexity threshold
- Identify the most complex functions in a codebase to prioritize refactoring efforts
- Track complexity regressions in pull requests by comparing against a baseline branch
- Generate SARIF reports for GitHub Code Scanning to surface maintainability issues as inline PR annotations
- Integrate with pre-commit hooks to catch overly complex functions before they reach the repository
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
complexipy is actively maintained, has no known vulnerabilities, uses a permissive MIT license, and fills a genuine need for cognitive complexity analysis in Python. The Rust backend and broad platform support (wheels for cp310, cp311, multiple architectures) reduce friction. It's suitable for teams wanting to measure and enforce code readability beyond traditional cyclomatic metrics.
Install
complexipy on PyPI
Before you install
Medium install friction due to compiled wheels across multiple platforms (cp310, cp311, and various architectures). Active maintenance with recent release (2 days old) and 761 repository stars indicate solid ongoing support.
License in practice
MIT license is permissive; you can use, modify, and distribute complexipy with minimal restrictions, making it suitable for both open-source and commercial projects.
Quickstart
pip install complexipy
from complexipy import file_complexity
result = file_complexity("app.py")
print(f"File complexity: {result.complexity}")
for func in result.functions:
print(f"{func.name}: {func.complexity}")
Verify before relying
- Whether the Rust implementation provides measurable performance gains over pure-Python alternatives in typical workflows
- How cognitive complexity scores correlate with actual maintenance burden or bug rates in practice
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.8 |
| Install friction | Medium. Platform-specific wheel |
| Runtime dependencies | 2 packagestomlityper |
| Maintenance | Actively maintained 2 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 610,329 / month, #5,767 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 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: LibrariesTopic :: Software Development :: Quality AssuranceTopic :: Software Development :: Testing |
Evidence: complexipy-7.0.1-cp310-cp310-macosx_10_12_x86_64.whl; complexipy-7.0.1-cp310-cp310-macosx_11_0_arm64.whl; complexipy-7.0.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; complexipy-7.0.1-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl; complexipy-7.0.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl; complexipy-7.0.1-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl; complexipy-7.0.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl; complexipy-7.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; complexipy-7.0.1-cp310-cp310-musllinux_1_2_aarch64.whl; complexipy-7.0.1-cp310-cp310-musllinux_1_2_x86_64.whl; complexipy-7.0.1-cp310-cp310-win32.whl; complexipy-7.0.1-cp310-cp310-win_amd64.whl; complexipy-7.0.1-cp311-cp311-macosx_10_12_x86_64.whl; complexipy-7.0.1-cp311-cp311-macosx_11_0_arm64.whl; complexipy-7.0.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; complexipy-7.0.1-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl; complexipy-7.0.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl; complexipy-7.0.1-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl; complexipy-7.0.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl; complexipy-7.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.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 › “cognitive complexity analysis python”
- complexipyCalculates cognitive complexity scores for Python code to measure how…
- flake8-cognitive-complexityA flake8 extension that checks Python code for cognitive complexity,…
- cognitive-complexityCalculates cognitive complexity scores for Python functions by…
Give your agent the search over MCP, or paste the wish link into any chat.
More Libraries packages
urllib3 is an HTTP client library that provides thread-safe connection pooling, SSL/TLS verification, multipart file uploads, request retries, compression support, and proxy handling for Python applications.
Requests is a Python HTTP library that simplifies sending HTTP/1.1 requests with automatic handling of headers, authentication, cookies, and response parsing.
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
Provides parsing, arithmetic, and recurrence rule computation for dates and times, with timezone support and iCalendar RFC compliance.
Install it if you need to parse flexible date strings, compute relative dates, handle timezones, or work with recurrence rules—it's the de facto choice for these tasks.
Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.
pytest is a testing framework that lets you write test functions using plain assert statements and automatically discovers and runs them, with detailed failure reporting.
See also cognitive-complexity · flake8-cognitive-complexity · lizard · xenon · mccabe · radon · flake8-annotations-complexity · diff-cover · pixelhog · refurb