Spaces:
Sleeping
Sleeping
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,94 +1,25 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
colorTo: green
|
| 6 |
-
sdk:
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
---
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
- Parse the source code using Python’s built-in `ast` module
|
| 26 |
-
- Identify function definitions and their relationships
|
| 27 |
-
- Show which functions:
|
| 28 |
-
- Are called from others
|
| 29 |
-
- Read or write to `st.session_state`
|
| 30 |
-
- Take specific arguments and return specific values
|
| 31 |
-
- Display all this in a **fully interactive graph** and table
|
| 32 |
-
|
| 33 |
-
---
|
| 34 |
-
|
| 35 |
-
## 🧠 What is AST?
|
| 36 |
-
|
| 37 |
-
AST stands for **Abstract Syntax Tree** — a structured representation of your source code as a tree. Each node represents a language construct like a function, loop, or assignment.
|
| 38 |
-
|
| 39 |
-
Code Graph uses ASTs to analyze code structure **without running the code**, making it safe and fast to use.
|
| 40 |
-
|
| 41 |
-
---
|
| 42 |
-
|
| 43 |
-
## 🚀 Features
|
| 44 |
-
|
| 45 |
-
✅ Upload one or more Python files
|
| 46 |
-
✅ Auto-detect function calls and dependencies
|
| 47 |
-
✅ Highlights:
|
| 48 |
-
|
| 49 |
-
- Function **arguments** and **return values** with inferred types (e.g. `df: pd.DataFrame`)
|
| 50 |
-
- Streamlit `session_state` **reads/writes**
|
| 51 |
-
- **Call order labels** on edges (`1`, `2`, `3`, …)
|
| 52 |
-
- **Thicker edges** for functions called multiple times
|
| 53 |
-
|
| 54 |
-
✅ Export the graph as downloadable JSON
|
| 55 |
-
✅ View everything in an interactive graph and sortable table
|
| 56 |
-
|
| 57 |
-
---
|
| 58 |
-
|
| 59 |
-
## 📂 How to Use
|
| 60 |
-
|
| 61 |
-
1. Launch the app or clone this repo
|
| 62 |
-
2. Upload one or more `.py` files
|
| 63 |
-
3. Select the "main" or top-level function to explore
|
| 64 |
-
4. Interact with the graph and table to trace logic
|
| 65 |
-
|
| 66 |
-
---
|
| 67 |
-
|
| 68 |
-
## 🛠 Tech Stack
|
| 69 |
-
|
| 70 |
-
- 🐍 Python
|
| 71 |
-
- 📦 Dash & Plotly
|
| 72 |
-
- 🧠 `ast` module (for static code parsing)
|
| 73 |
-
- 🌐 Cytoscape.js (for interactive graph rendering)
|
| 74 |
-
|
| 75 |
-
---
|
| 76 |
-
|
| 77 |
-
## 🙋♂️ About the Author
|
| 78 |
-
|
| 79 |
-
Created by **Tomas Larsson**, a data scientist and creator of
|
| 80 |
-
[**my.moneytoolbox.com**](https://my.moneytoolbox.com) — a blog covering:
|
| 81 |
-
|
| 82 |
-
- Tax-optimized investing
|
| 83 |
-
- Retirement modeling
|
| 84 |
-
- Financial tools for DIY investors
|
| 85 |
-
|
| 86 |
-
---
|
| 87 |
-
|
| 88 |
-
## 📤 Deployment (Docker-based)
|
| 89 |
-
|
| 90 |
-
If you're running locally:
|
| 91 |
|
| 92 |
-
```bash
|
| 93 |
-
docker build -t code-graph .
|
| 94 |
-
docker run -p 7860:7860 code-graph
|
|
|
|
| 1 |
---
|
| 2 |
+
title: Function Call Visualizer (Python)
|
| 3 |
+
emoji: 🧠
|
| 4 |
+
colorFrom: indigo
|
| 5 |
colorTo: green
|
| 6 |
+
sdk: gradio
|
| 7 |
+
app_file: app.py
|
| 8 |
+
tags:
|
| 9 |
+
- python
|
| 10 |
+
- static-analysis
|
| 11 |
+
- ast
|
| 12 |
+
- code-visualization
|
| 13 |
+
- dev-tools
|
| 14 |
+
- dash
|
| 15 |
+
- streamlit
|
| 16 |
+
- call-graph
|
| 17 |
+
pinned: true
|
| 18 |
+
license: mit
|
| 19 |
+
---
|
| 20 |
+
|
| 21 |
+
Upload your Python files and see how your functions call each other—visually.
|
| 22 |
+
No execution needed. Great for refactoring, onboarding, auditing, and debugging.
|
| 23 |
+
|
| 24 |
+
Built by [Tomas Larsson](https://www.linkedin.com/in/tomaslarsson/) | [my.moneytoolbox.com](https://mymoneytoolbox.com)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
|
|
|
|
|
|
|
|