A CLI tool that analyzes Python projects and generates a hierarchical tree of function calls.
- 📊 Function Call Tree - Visualizes which functions call which in a tree format
- 🔄 Multi-Caller Detection - Marks functions called from multiple places with
[*] ⚠️ Unused Function Detection - Lists functions that are never called- 🚫 GitIgnore Support - Respects
.gitignorepatterns - 📁 File Grouping - Groups results by file for easy navigation
- Python 3.7+
- A
.gitignorefile must exist in the target project root (mandatory)[can be left empty]
.gitignoreis recommended especially if the workspace have./build or android or node_modulesor similar folders which will be Larger in depth.
git clone https://github.com/karthikvvk/WorspaceTreeMaker.git
cp treemaker.py <ur_workspace_path> #Copy treemaker.py to the root of ur workspace
python treemaker.pypython treemaker.py #this takes "./"as Base dir================================================================================
PYTHON PROJECT FUNCTION CALL TREE
================================================================================
Project: /path/to/project
Files analyzed: 5
Functions found: 23
--------------------------------------------------------------------------------
FILES ANALYZED:
--------------------------------------------------------------------------------
• main.py
• utils/helpers.py
• services/api.py
--------------------------------------------------------------------------------
LEGEND:
--------------------------------------------------------------------------------
[*] = This function is also called from other places
└── = Calls to other functions
================================================================================
FUNCTION CALL TREE (Entry Points)
================================================================================
main (main.py:15)
└── initialize (main.py:20)
└── setup_logging [*] (utils/helpers.py:10)
└── load_config (utils/helpers.py:25)
└── parse_yaml (utils/helpers.py:40)
run_server (main.py:45)
└── setup_logging [*] (utils/helpers.py:10)
└── ... (already shown above)
└── handle_request (services/api.py:12)
================================================================================
UNUSED FUNCTIONS
================================================================================
(Functions that are never called by any other analyzed function)
--------------------------------------------------------------------------------
📁 utils/helpers.py
⚠️ deprecated_function (line 100)
⚠️ old_parser (line 150)
================================================================================
- Parsing: Uses Python's
astmodule to parse all.pyfiles - Filtering: Respects
.gitignorepatterns to skip irrelevant files - Analysis:
- Extracts all function definitions (including class methods)
- Tracks which functions call which
- Identifies entry points (functions not called by others)
- Detects multi-caller functions
- Output: Renders a clean tree structure in the terminal
| Symbol | Meaning |
|---|---|
[*] |
Function is called from multiple places |
└── |
Child call (function calls this) |
├── |
Sibling call (more calls follow) |
... (already shown above) |
Subtree already printed, avoiding duplication |
⚠️ |
Unused function warning |
- Only analyzes Python files (
.py) - Dynamic function calls (via
getattr, etc.) may not be detected - External library calls are not tracked
- Decorator-based calls may not be fully resolved