DEV Community

Cover image for CytoScnPy - Fast Python Static Analysis
djinn-soul
djinn-soul

Posted on

CytoScnPy - Fast Python Static Analysis

CytoScnPy is a high-performance static analysis tool for Python built to help developers understand, clean, and secure their codebases with speed and precision.

At its core, CytoScnPy combines the safety and performance of Rust with a seamless Python interface, giving you deep insights into your Python projects without sacrificing efficiency.

It detects:

  • Dead code
  • Security risks
  • Code quality issues

All through a simple CLI or integrated workflow.


⚑ Key Capabilities

🧹 Dead Code Detection

Find unused functions, classes, imports, and variables with cross-file and nested scope awareness.

πŸ” Security Analysis

Detect secrets (API keys, credentials) and patterns of dangerous code. Includes basic taint analysis to flag potential injection vectors.

πŸ“Š Quality Metrics

Reports on:

  • Cyclomatic complexity
  • Maintainability Index (MI)
  • Halstead metrics
  • Nesting depth

🧠 Framework Awareness

Special handling for popular Python frameworks like:

  • Flask
  • Django
  • FastAPI
  • Pydantic
  • Azure Functions

🎯 Smart Heuristics

Supports:

  • Dataclasses
  • Dynamic attributes
  • Nuanced export detection

πŸ›  How It Works

CytoScnPy is built in Rust for performance but exposes a familiar Python-centric CLI and API.

It’s designed to be:

  • Fast & lightweight β€” optimized static analysis with minimal memory usage
  • Comprehensive β€” combines quality, security, and dead code checks in one run
  • CI-friendly β€” works in GitHub Actions and modern CI/CD pipelines

πŸš€ Installation

Install via pip:

pip install cytoscnpy
Enter fullscreen mode Exit fullscreen mode

Or use the cross-platform installer scripts:

curl -fsSL https://raw.githubusercontent.com/djinn09/CytoScnPy/main/install.sh | bash
Enter fullscreen mode Exit fullscreen mode

Windows PowerShell:

irm https://raw.githubusercontent.com/djinn09/CytoScnPy/main/install.ps1 | iex
Enter fullscreen mode Exit fullscreen mode

πŸ“Š Typical Usage

Run CytoScnPy against your project directory:

cytoscnpy . --secrets --danger --quality --json
Enter fullscreen mode Exit fullscreen mode

Generate reports, filter findings by confidence, or integrate it into your CI pipeline to enforce quality and security gates.


πŸ”— GitHub: https://github.com/djinn-soul/CytoScnPy

Top comments (0)