Visualize the dependency graph of a Julia package
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
.
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.
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 the Reference section in the .
See 'Known limitations & Bugs' in the issue tracker. Also see Roadmap.
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
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.
For the latest commit on main
(aka dev and unstable):
CI status |
---|
You can install PkgGraph
at this latest commit using
pkg> add https://github.com/tfiers/PkgGraph.jl
It might be a good idea to install at a fixed revision instead. Preferably at one that passed tests. For example:
pkg> add https://github.com/tfiers/PkgGraph.jl#50bc308
Ideas for improvement are currently managed with GitHub issues.
User-visible enhancements to src/
are labelled with .
No progress guaranteed, Software provided 'as is', etc.
Well-considered PRs, Issues, and Discussions are welcome.
Participants are expected to adhere to the standards for constructive communication as e.g. described in this Code of Conduct.
Check out the code for development using
pkg> dev PkgGraph
One fun development method is to open one of the src/
files
in, e.g, VS Code, and treat is as a script, breaking open functions
and executing individual lines in the integrated Julia REPL.
(Dummy input data can be copy-pasted in from the corresponding file
in test/
).
See the readmes in test/
and in docs/
for how to locally run the tests and build the documentation.
See the Developer Guide in the documentation for more.
Julia packages similar to PkgGraph.jl:
See Related work in the documentation for more info.