Donโt know of a tree-like visualization option, but there is st --manifest for showing all dependencies (typing on my mobile phone and canโt check the precise name of the option.)
Thank you!
But how did you know about that option? I could not find any options for any Pkg commands yetโฆ
(KiteModels) pkg> st --help
ERROR: option 'help' is not a valid option
OK, found it:
(KiteModels) pkg> ?st
[st|status] [-d|--diff] [pkgs...]
[st|status] [-d|--diff] [-p|--project] [pkgs...]
[st|status] [-d|--diff] [-m|--manifest] [pkgs...]
Show the status of the current environment. In --project mode (default), the status of the project file is summarized. In --manifest mode the output also includes the recursive dependencies of added packages given in the manifest. If there are any packages listed as arguments the output will be limited to those
packages. The --diff option will, if the environment is in a git repository, limit the output to the difference as compared to the last git commit.
โ Julia 1.1
โ
โ pkg> status with package arguments requires at least Julia 1.1.
โ Julia 1.3
โ
โ The --diff option requires Julia 1.3. In earlier versions --diff is the default for environments in git repositories.
For pedagogical reasons I will write out how I came about the solution (since I am not a Pkg expert โ i would bet there are easier ways to access this information).
The documentation of Pkg.status cross-refs the functions Pkg.project and Pkg.dependencies as alternatives that donโt print out the results, so we are going to use those.
Now the hard part: knowing that AbstractTrees.jl โ which we can use to transverse the tree โ already has a print function so all we have to do is chain both.
using AbstractTrees
using Pkg
function AbstractTrees.printnode(io::IO, uuid::Base.UUID)
dep = get(Pkg.dependencies(), uuid, nothing)
print(io, dep.name)
end
function AbstractTrees.children(uuid::Base.UUID)
dep = get(Pkg.dependencies(), uuid, nothing)
dep.dependencies
end
# Example (with some package you have in your Project.toml -- in my case Pluto)
AbstractTrees.print_tree(Pkg.project().dependencies["Pluto"])
# Print all dependencies: definitely do not recommend
# AbstractTrees.children(x::Pkg.API.ProjectInfo) = x.dependencies
# AbstractTrees.printnode(io::IO, x::Pkg.API.ProjectInfo) = x.name
# AbstractTrees.print_tree(Pkg.project())
I was thinking that the right visualization would not be a tree, since, if we root at the current environment, the same package might appear at several places. A directed graph would be a better representation.