PkgGraph.jl
Visualize the dependency graph of a Julia package
Example
using PkgGraph
depgraph_web(:Unitful)
This will open the browser to this url, which renders something like the following:
Packages in the Julia standard library are by default faded-out.
To remove them entirely from the graph, set the keyword argument
stdlib = false
.
Similarly, you can filter out binary dependencies (JLL packages)
by setting jll = false
.
Local rendering
If you are offline, you can use something like
depgraph_image(:Unitful, dir=".", fmt=:svg)
This will call dot
to create an SVG image in the current directory ("."
), and will open it with your default image viewer.
If only the package-name is provided, dir = tempdir()
and fmt = :png
are used.
Customization
The code tries to be modular. So if you want something a bit different than what the above interface offers, you might be able to compose it from various internal functions: see Internals.
Limitations
See 'Known limitations & Bugs' in the issue tracker. Also see Roadmap.
Installation
PkgGraph is available in the Julia general registry and can be installed as usual with
pkg> add PkgGraph
It supports Julia versions down to 1.6
Global Install
You might want to install PkgGraph
in your base environment (e.g. v1.9
).
You can then use it in any project, without having to install it in that project
or having to switch projects.
You can activate your base environment using ] activate
(i.e. activate 'nothing'),
and then add PkgGraph
there.
Another way to obtain a global install is to run – from within any environment:
julia> using PkgGraph
If the package is not found, Julia will offer to install it.
Type 'o
' to choose to install it in your base environment.