Below is the dependency graph of our stdlib:
There are a few unfortunate dependencies. One for example is the Test --> Distributed --> LinearAlgebra, which means that you cannot use the Test stdlib without having the LinearAlgebra stdlib.
Perhaps some refactorings to avoid this would be useful. Test uses only myid
from Distributed for example.
Figure created with:
cd("/Users/kristoffer/julia/stdlib")
import TOML
using LightGraphs
using TikzGraphs
using TikzPictures
const STDLIB_DIR = "."
const STDLIBS = readdir(STDLIB_DIR)
deps = Dict{String, Int}()
for (i, stdlib) in enumerate(STDLIBS)
deps[stdlib] = i
end
g = LightGraphs.SimpleGraphs.SimpleDiGraph(length(STDLIBS))
for (i, stdlib) in enumerate(STDLIBS)
proj = TOML.parsefile(joinpath(STDLIB_DIR, stdlib, "Project.toml"))
if haskey(proj, "deps")
for (stdlib_dep, uuid) in proj["deps"]
add_edge!(g, deps[stdlib], deps[stdlib_dep])
end
end
end
t = TikzGraphs.plot(g, Layouts.SimpleNecklace(), STDLIBS)
TikzPictures.save(SVG("graph"), t)
Nice, +1 to breaking dependency edges.
Distributed only uses LinearAlgebra in order to call BLAS.set_num_threads(1)
. That could be replaced with some kind of hook mechanism instead, so all threaded libraries can register callbacks to do the same thing.
Another one I noticed: SharedArrays uses a single sprintf call that could easily be replaced.
I also just noticed we have a cycle: ["REPL", "InteractiveUtils", "Pkg"]
, Would be nice to break if possible.
Pkg
-> REPL
-> InteractiveUtils
-> LinearAlgebra
makes it impossible to use the package manager without BLAS :stuck_out_tongue:
Updated version of the tree
Is it actually a DAG now?
GraphViz/dot says yes:
(see gist)
Sorry, my analysis applies to the 1.0.2 release, of course, not some branch where refactoring is happening.
Nice graph!
Yes, very nice graph! This dependency graph is starting to look a bit more reasonable.
Test -> Distributed
, InteractiveUtils -> LinearAlgebra
, Distributed -> LinearAlgebra
are probably the worst ones right now.
Fortunately https://github.com/JuliaLang/julia/pull/29978 removed InteractiveUtils -> LinearAlgebra
and https://github.com/JuliaLang/julia/pull/30004 removes Distributed -> LinearAlgebra
.
Update after #29978 and #30004 :
In particular LinearAlgebra
is now pretty isolated to packages that are actually linalg related and e.g. the package manager is not dependent on LinearAlgebra
anymore :tada:
Very good, this looks quite reasonable.
Wow, that's such a nice, sane dependency graph now!
Fantastic work! 鉂わ笍 馃帀
Most helpful comment
Update after #29978 and #30004 :
In particular
LinearAlgebra
is now pretty isolated to packages that are actually linalg related and e.g. the package manager is not dependent onLinearAlgebra
anymore :tada: