package module-graph
All checked builds passInstall
dune-project
Dependency
Authors
Maintainers
Sources
sha256=ec199626be52f5dd03a6ff13bc5053b42523ac0798bf7ca07f631bea2dc0df92
Description
The module-graph tool generates a graph of dependencies between OCaml modules using compiled object files. module-graph scans the current directory and sub-directories looking for .cmt/.cmti/.cmi files, creates a memory graph of dependencies between them, and uses dot to display the graph into a pdf/image file.
README
module-graph
The module-graph tool generates a graph of dependencies between OCaml modules using compiled object files. module-graph scans the current directory and sub-directories looking for .cmt/.cmti/.cmi files, creates a memory graph of dependencies between them, and uses dot to display the graph into a pdf/image file.
See examples of generated graphs at the end of this file.
Installation
The module-graph binary should be built with the same version of OCaml as the project you want to analyze with it.
The recommended way to install it is, within your project opam switch:
opam pin git+https://github.com/OCamlPro/module-graphThis command should ask you confirmation to create the packages contained in the module-graph project, and then install it in the switch.
You will also need to have dot installed on your computer: on Debian/Ubuntu systems, it is part of the graphviz package.
Usage
In your project, just run:
$ module-graph
Generated 23 edges in "deps.dot" and "deps.pdf"
$ evince deps.pdfBy default, module-graph scans the current directory and its sub-directories, looking for .cmt/.cmti files. It only ignores the _opam/ sub-directory.
You can specify another set of directories to scan:
$ module-graph _build/default/src/parsers
Generated 6 edges in "deps.dot" and "deps.pdf"You can change the format of the generated file with -T/--format FORMAT:
$ module-graph --format png
Generated 23 edges in "deps.dot" and "deps.png"
$ display deps.pngYou can change the name of the generated file with -o/--output BASENAME:
$ module-graph -o alt-ergo-deps
Generated 23 edges in "alt-ergo-deps.dot" and "alt-ergo-deps.pdf"
$ evince alt-ergo-deps.pdfIn some cases, .cmt/.cmti files are not available, so you may want to use .cmi files with --cmi:
$ module-graph --cmi
Generated 21 edges in "deps.dot" and "deps.pdf"
$ evince deps.pdfBy default, module-graph drops direct links between modules if these links are implied by transitive dependencies. You can keep them with -A/--all-links:
$ module-graph --all-links
Generated 32 edges in "deps.dot" and "deps.pdf"
$ evince deps.pdfIf modules are packed/wrapped within a module (default behavior for dune), you may use the -R/--remove-pack MODNAME to filter modules (keeping only the ones within the pack) and remove the corresponding prefix:
$ module-graph --remove-pack AltErgoLib
Generated 19 edges in "deps.dot" and "deps.pdf"
$ evince deps.pdfYou can display the filenames in the grap instead of the module names using the --filenames option:
$ module-graph --filenames
Generated 23 edges in "deps.dot" and "deps.pdf"
$ evince deps.pdfYou can filter out modules using a regexp with -X/--ignore-module REGEXP where regexp is in the glob format:
$ module-graph -X 'AltErgoLib__*'
Generated 3 edges in "deps.dot" and "deps.pdf"
$ evince deps.pdfExamples
- Raw Dependencies for
module-graph:
- All Dependencies for
module-graph(--all-links):
- Raw Dependencies for
alt-ergo:
- Dependencies restricted to
AltErgoLibforalt-ergo(--remove-pack AltErgoLib):
Resources
- Website: https://ocamlpro.github.io/module-graph
- General Documentation: https://ocamlpro.github.io/module-graph/sphinx
- API Documentation: https://ocamlpro.github.io/module-graph/doc
- Sources: https://github.com/ocamlpro/module-graph
Dependencies (5)
-
ocplib_stuff
>= "0.3" -
ez_file
>= "0.3" - ocaml-base-compiler
-
dune
>= "2.7.0" -
ocaml
>= "4.07.0"
Dev Dependencies (4)
-
ocamlformat
with-test -
odoc
with-doc -
ppx_expect
with-test -
ppx_inline_test
with-test
Optional Dependencies
None
Used by
None
Conflicts
None
Build status
Results of building module-graph with each compiler on check.ci.ocaml.org, run of against opam-repository 8a77e58. All results for this package.
Each result links to its build log. To keep crawlers from overloading the site, build logs require a GitHub sign-in (see ocurrent/opam-health-check). On your first log, GitHub asks you to “Authorize opam-health-check”, the OCurrent app that runs these checks; it sees only your public profile, not your repositories. The sign-in lasts 30 days.
| Version | OCaml 4.11 | OCaml 4.14 | OCaml 5.2 | OCaml 5.4 | OCaml 5.5 |
|---|---|---|---|---|---|
| 0.2.0 (this version) | good | good | good | good | good |
- good Package successfully built
- partial One of the dependencies failed to build
- bad Package failed to build
- n/a Package is not available in this environment
- internal Internal failure