Skip to main content

Live time complexity and memory usage analysis for Python code

Project description

🔍 CodeInsight

PyPI version Python 3.6+ License: MIT Build Status

A comprehensive toolkit for analyzing Python code complexity, quality, and performance metrics

✨ Overview

CodeInsight helps developers identify bottlenecks, complexity issues, and potential bugs in Python code. By providing detailed metrics and visualizations, it empowers teams to write cleaner, more maintainable, and more efficient code.

🚀 Installation

pip install codeinsight

🏁 Quick Start

Command Line Usage

# Basic analysis of a file
codeinsight example.py

# Analyze a directory with detailed reporting
codeinsight ./src --verbose

As a Python Library

# Import the analyze function
from codeinsight import analyze

# Analyze a file
result = analyze("example.py")
print(result)

# Or use the CodeInsight class directly for more control
from codeinsight import CodeInsight

with open("example.py", "r") as f:
    code = f.read()

analyzer = CodeInsight(code)
result = analyzer.get_analysis()
print(result)

🛠️ Features

Feature Description
Complexity Analysis Calculate cyclomatic complexity, cognitive complexity, and Halstead metrics
Performance Metrics Estimate time and space complexity, track memory usage
Code Quality Detect code smells, anti-patterns, and maintainability issues

Supported Analysis Types

  • Structural Analysis: AST-based parsing for deep code understanding
  • Complexity Metrics: Cyclomatic, cognitive, and Halstead complexity
  • Performance Profiling: Execution time and memory usage estimation
  • Pattern Detection: Identify common anti-patterns and code smells
  • Documentation Coverage: Measure docstring completeness and quality

🔧 Requirements

  • Python 3.6+
  • click
  • rich
  • memory_profiler
  • radon
  • astor

👥 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📝 License

This project is licensed under the MIT License - see the LICENSE file for details.

💖 Acknowledgements

  • The Radon project for complexity metrics
  • AST module from the Python standard library
  • All our contributors

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

codeinsight-1.0.1.tar.gz (15.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

codeinsight-1.0.1-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

File details

Details for the file codeinsight-1.0.1.tar.gz.

File metadata

  • Download URL: codeinsight-1.0.1.tar.gz
  • Upload date:
  • Size: 15.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.11

File hashes

Hashes for codeinsight-1.0.1.tar.gz
Algorithm Hash digest
SHA256 8464a1c03c0cd427cd244e615c596ff2ba128e61157b8ebe35dfda57023c2450
MD5 c08c747e7ca767b95b7f82c4f85943b4
BLAKE2b-256 721594c4b72d33d57e90f8a5e1ade6e484cbbdd8d30ad5a511a0a4f83a23d81d

See more details on using hashes here.

File details

Details for the file codeinsight-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: codeinsight-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 14.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.11

File hashes

Hashes for codeinsight-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8b63de202422f55abcaeeadf5f26b730ee29f1b8bcb0b1b1318ad4f6e6e7bd44
MD5 3371b1cea79d165053ffbb6354366912
BLAKE2b-256 e1e2a241517829a73953ac0b0d28f415d4a38d990814d4868d18100813909b92

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page