#cargo-metadata #graph #graphviz #create #transitive #projects #generate

app cargo-depgraph

Creates dependency graphs for cargo projects using cargo metadata and graphviz

15 stable releases

1.6.0 Dec 7, 2023
1.5.0 Jun 26, 2023
1.4.0 Nov 23, 2022
1.2.5 Jun 23, 2022
0.1.0 Jul 9, 2020

#15 in Visualization

Download history 39/week @ 2023-11-24 54/week @ 2023-12-01 95/week @ 2023-12-08 34/week @ 2023-12-15 19/week @ 2023-12-22 34/week @ 2023-12-29 20/week @ 2024-01-05 13/week @ 2024-01-12 35/week @ 2024-01-19 42/week @ 2024-01-26 23/week @ 2024-02-02 47/week @ 2024-02-09 74/week @ 2024-02-16 93/week @ 2024-02-23 94/week @ 2024-03-01 46/week @ 2024-03-08

308 downloads per month

GPL-3.0-or-later

37KB
756 lines

cargo-depgraph

Creates dependency graphs for cargo projects using cargo metadata and graphviz.

Installation

cargo install cargo-depgraph

If you are using Arch Linux, you can alternatively install via pacman -S cargo-depgraph.

Usage

Note: This assumes you have Graphviz installed. There are also online tools that can generate graphics from the textual graphviz graphs cargo depgraph generates, if the command-line graphviz tools like dot aren't your thing.

cargo depgraph [options] | dot -Tpng > graph.png

The full list of options can be seen by running

cargo depgraph --help

Commonly useful options:

  • --all-deps

cargo-depgraph's dependency graph

  • --all-deps --dedup-transitive-deps

cargo-depgraph's dependency graph with transitive dependency edges de-duplicated

Output explanation

  • square node = root / workspace member
  • grey background = target-specific dependency
  • dotted lines = optional dependency (could be removed by disabling a cargo feature)
  • dashed lines = transitively optional dependency (could be removed by removing one of the dotted edges)
  • line colors = dependency kinds w.r.t. root / workspace members
    • black = normal
    • blue = dev-dependency
    • green = build-dependency
    • light turquoise = build-dependency of a dev-dependency
    • dark green = both normal and build-dependency
    • violet = both dev-dependency and build-dependency
    • … not seen in the wild yet, but theoretically possible:
      • dark turquoise = both normal and build-dependency of a dev-dependency
      • pastel blue = both dev-dependency and build-dependency of a dev-dependency
    • red = you broke it

Dependencies

~4.5MB
~84K SLoC