Visualize the import relationships between all modules in a python codebase. Works with Python 2 or 3.
Very much a work in progress.
Does not yet play well with relative imports (from .. import blah
). Prefer from my.abs.path import blah
.
Better process coming soon, hopefully.
Python 2
python -m virtualenv venv
source venv/bin/activate
pip install -r requirements.txt
Python 3
python3 -m venv venv3
source venv3/bin/activate
pip install -r requirements.txt
# must have venv/venv3 activated
$ python src/vis.py <root project directory>
Example:
Running the visualizer on the toy project
directory in this repository:
$ python src/vis.py project
Module dependencies:
hello
module_a
main
path.to.module_c
module_a
module_b
module_d
path
path.to
path.to.module_c
module_a
module_b
Also displays with graphviz
:
Another example graph from a slightly more substantial project (blue arrows/nodes indicate modules where the code does not live in the project directory [such as modules installed through pip]):