complexipy
A Python library and CLI tool to calculate cognitive complexity of Python files and analyze code maintainability.
At a Glance
Pricing
Free and open source under MIT license
Engagement
Available On
About complexipy
complexipy is a Python library and command-line tool designed to calculate the cognitive complexity of Python source code. It helps developers identify complex code sections that may be difficult to understand and maintain, enabling better code quality and refactoring decisions. The tool analyzes Python files and provides detailed complexity metrics based on the cognitive complexity metric.
Key Features:
- Cognitive Complexity Analysis - Calculates cognitive complexity scores for Python functions and files, helping identify code that may be hard to understand or maintain
- CLI Interface - Provides a straightforward command-line interface to analyze individual files, directories, or entire projects with customizable options
- Library Integration - Can be imported as a Python library for programmatic access to complexity calculations within your own tools and workflows
- Detailed Reporting - Generates comprehensive reports showing complexity scores per function, allowing targeted refactoring efforts
- Configurable Thresholds - Set maximum complexity thresholds to enforce code quality standards and fail builds when complexity exceeds limits
- Fast Performance - Built with Rust for high-performance analysis, capable of processing large codebases quickly
- JSON Output - Supports JSON output format for easy integration with CI/CD pipelines and other automation tools
- Git Integration - Can analyze only changed files in a git repository for efficient incremental analysis
To get started, install complexipy using pip with pip install complexipy. Once installed, run complexipy . in your project directory to analyze all Python files. Use complexipy --help to see all available options including setting complexity thresholds, output formats, and filtering options. The tool can be integrated into pre-commit hooks or CI pipelines to maintain code quality standards across your team.
Community Discussions
Be the first to start a conversation about complexipy
Share your experience with complexipy, ask questions, or help others learn from your insights.
Pricing
Open Source
Free and open source under MIT license
- Full cognitive complexity analysis
- CLI interface
- Python library integration
- JSON output
- Configurable thresholds
Capabilities
Key Features
- Cognitive complexity calculation
- CLI interface
- Python library integration
- JSON output format
- Configurable complexity thresholds
- Directory and file analysis
- Git integration for changed files
- Fast Rust-based performance
- Detailed function-level reporting