[ANN] odep initial release

I’m glad to announce the initial release of odep – dependency graphs generator for OCaml modules, libraries and packages.

Some months ago I was frustrated with the lack of such modern tool (list of similar ones I found) and decided to code up one universal tool that covers all the use cases (xkcd reference). After interest from the community, I have now made a proper release of the tool on opam.

Example

Running odep dune | dot -Tsvg in the project’s own repository produces the following comprehensive graph. It shows modules in the project itself, clustered by dune libraries, and other findlib libraries, clustered by opam packages. This information is gathered and combined from dune describe workspace --with-deps, findlib and opam.

See README on GitHub for more usage examples.

36 Likes

Looks great! But is it tool-friendly? I could really use something like this to help convert dune files to Bazel files, but for that it would need to produce something that I can (easily) parse, like sexps. Can it do that? It would also be great if it were available as a library.

It simply uses dune describe workspace --with-deps to get information from a dune project. That already is sexp output, so you might as well parse it directly (like odep does) and use it however you need, as opposed to having odep provide a library-like abstraction layer on top of that.

Thanks! I hacked something quick when I had the same need (as a hacky branch on top of @mjambon’s dune-deps), but the output of your tool is much nicer, I will use it next time. Also, dune-deps appears to be unmaintained so it is good to have a replacement.

(Random implementation note: when I had to hack something from the Dune output I had a need for a combinator library to process s-expressions, discussed in Combinator library for extracting data for s-exps? . I see that your projects uses the @@deriving route ( odep/dune_describe.ml at master · sim642/odep · GitHub ), which I guess is a fine solution in this specific case – as proposed in Combinator library for extracting data for s-exps? - #25 by Gopiandcode . My own take-away from the discussion was that ocaml-decoders and its Decoders_sexplib package also work well for this need – Combinator library for extracting data for s-exps? - #37 by gasche .)