Skip to content

Repository files navigation

IQGraphify

A local, offline graph visualizer for Python projects. IQGraphify scans a codebase, builds an interactive dependency graph (imports, function calls, folder structure), and can replay live runtime execution as your code runs — function by function, file by file.

Built to integrate with IQAgent but works as a standalone tool for any Python project.

Features

  • Interactive project graph — visualize file relationships: imports, function calls, folder containment
  • Live runtime trace — right-click an entry point or test file, run it, and watch the graph light up function-by-function as it executes
  • Replay mode — slow-motion playback of the last run, since live execution is often too fast to follow
  • AI-generated summaries — each file gets a short topic summary using a local GGUF model (fully offline, no API keys)
  • Project-aware — caches results in output/graph_memory.json so reopening a project is instant
  • Node search — jump to any file by name

Requirements

  • Windows 10/11 (tested platform; PyQt5 is cross-platform but this project assumes Windows paths in places)
  • Python 3.10+
  • llama.cpp built locally (for AI summaries — optional, can be skipped)
  • A GGUF model file (e.g. Qwen3-0.6B or similar small model) — optional, can be skipped

Setup

git clone https://github.com/iqbal-irfan/IQGraphify.git
cd IQGraphify
python -m venv venv
venv\Scripts\activate
pip install -r requirements.txt

Optional: AI Summaries

To enable file summaries, you need:

  1. A local build of llama.cpp (specifically llama-server.exe)
  2. A .gguf model file placed in the LLM model/ folder

Update config.yaml with the path to your llama-server.exe:

llama_server:
  executable: "C:/path/to/your/llama.cpp/build/bin/Release/llama-server.exe"
  model: "LLM model/your-model.gguf"
  port: 8080

If you skip this setup, choose "Skip (no summaries)" in the model selector dialog on launch — the graph still works fully, just without AI-generated file summaries.

Usage

Standalone

python app.py "C:\path\to\your\project"

Or launch without a project and use Run Graphify from the menu to pick a folder.

From IQAgent

IQGraphify is designed to be launched from IQAgent's Visualize button, which passes the active project path automatically and listens for node-click signals to open files in IQAgent's editor.

How it works

Graph generation

file_graph_builder.py walks the target project, extracts function definitions and call/import relationships via regex, and builds a node/edge graph rendered with pyvis (vis.js under the hood).

Live runtime visualization

When you right-click an entry point file (main.py, app.py, gui.py, run.py) or a test file (test_*.py) and choose Run This File:

  1. core/_trace_runner.py launches the file in a subprocess, with all class methods wrapped to emit RUNTIME: trace lines as they execute
  2. core/graph_engine.py reads this output and forwards events to the graph
  3. ui/live_graph.py (injected JavaScript) highlights the active node and shows a live function list — pending functions in red, the currently running function in gold, completed functions in green
  4. The full execution sequence is recorded, so you can hit Replay afterward to watch it again in slow motion

Why not just use sys.settrace?

GUI frameworks like Tkinter override sys.settrace internally, so a naive trace approach silently stops working once mainloop() starts. Instead, IQGraphify wraps each class's methods directly after import, so traces fire regardless of what's running the event loop.

Project Structure

IQGraphify/
├── api/                  # Public API (GraphAPI) for external integration
├── core/                 # Graph engine, runtime tracer, LLM manager
├── ui/                   # PyQt5 UI, JS graph bridge, model selector
├── lib/                  # Bundled vis.js / tom-select assets
├── LLM model/             # Place your .gguf model here (not included)
├── output/                # Generated graph_memory.json, graph.html
├── app.py                 # Entry point
├── pyqt_graph_app.py       # Base GraphApp widget
└── config.yaml             # Physics, server, UI settings

Known Limitations

  • Windows-focused (hardcoded path separators in a few places)
  • Live trace works at the function level, not line level
  • Large projects (1000+ files) may render a cluttered graph — no auto-layout tuning yet

Acknowledgments

This project was developed with the help of ChatGPT, Claude, and Qwen.

License

MIT — see LICENSE for details.

About

IQGraphify is an open-source Python application that converts documents and source code into interactive knowledge graphs using local AI models. It helps developers and researchers visualize entities, relationships, and project structure while keeping all processing offline and private.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Sponsor this project

Packages

Contributors

Languages