A Python tool for visualizing dependencies between modules in Python projects.
- mapper.py: Analyzes Python projects and generates dependency graphs
- visualizer.py: Interactive GUI for visualizing dependency relationships
- Static analysis of Python module dependencies
- Interactive graph visualization
- Multiple layout options (Kamada-Kawai, Spring, Circular)
- Directory-based color coding
- Click-to-highlight dependencies
- Zoom and pan capabilities
Here are some examples of features the author finds most useful, and an explanation of each.
- Circular Layout (default)
This layout emphasizes cyclic dependencies and provides a clear overview of module relationships. Each node represents a python file found in the package, and each node is colored by its parent folders.
- Node Select
Nodes can be selected by clicking on them. Selected nodes show up in bold white text, it's neighbors will show up in larger white font. All other nodes are pushed to the background.
Blue arrows represent import calls by other files, i.e. in <other_file.py> you will find some version of import <selected> or from <selected> import <foo>.
Red arrows represent dependencies, i.e. in <selected.py> you fill find a import <other_file.py> or from <other_file.py> import <bar>.
- Layout Selector
The layout of the nodes can be changed to a range of options. The most useful tend to be Circular, Arf, and Multipartite (which is structured by the folder structure of the project). Changing layout preserves the state of the graph and does not clear selections.
- Color Change Button
The color scheme of the nodes can be changed to be more appealing by pressing the "Change Color" button. The color scheme is regenerated using a variation of saturations and values, and repeatedly increasing the hue by the golden ratio and taking its remainder from 1: new_hue = old_hue + 0.618033988749895 % 1.0. This guarantees that no two colors will be identical for an extremely large set of numbers. However, the cyclical nature of the operation can result in color schemes which are similar and the user may need to cycle color schemes several times to find an appealing option.
- Python 3.11
- PyQt5
- matplotlib
- networkx
- scipy
- ruff
- pre-commit
- mypy
- setuptools
This project uses uv to manage packages and virtual environments.
curl -LsSf https://astral.sh/uv/install.sh | sh
uv sync
source .venv/bin/activate- Run the mapper to analyze your project:
python src/mapper.py --path <path/to/directory/to/analyze> --output <tag_for_output>the output will be written to cfg/<tag_for_output>.txt
- Launch the visualizer:
python src/visualizer.py- Click "Load Dependencies" and select the
cfg/<tag_for_output>.txtfile
MIT License
Neil Schroeder



