When you install python packages using pip, it remembers the dependency tree of installed packages. Together with Graphviz, pipdeptree can generate a nice visualization of python project dependencies.
or, render dependency graph as a pdf file
What is even better is – It allows to save the output in a user friendly format such as jpeg, png or pdf.
How to use it on Windows 10 PC
- Download Graphviz from this link
-
Add below to PATH environment variable (Update the installed graphviz version if needed)
C:\Program Files (x86)\Graphviz2.38\bin
C:\Program Files (x86)\Graphviz2.38\bin\dot.exe
-
Close any open command prompt, restart it and navigate to your python project folder. e.g.,
cd C:\Projects\GitHub\Installer_Bootstrapper
-
Install ‘pipdeptree’ and ‘graphviz’ python libraries
pip install pipdeptree
pip install graphviz
- Now you can start testing 'pipdeptree'
- View dependency tree of all installed packages
- View dependency tree of a particular packages - django
- View reverse dependency tree
- Now, let’s visualize it as jpeg image using GraphViz
or, render dependency graph as a pdf file
pipdeptree --graph-output pdf > out.pdf
Comments