I recently put together a lightweight open-source tool for visualizing dependencies among Fortran modules. I built it because I wanted a simple way to inspect relationships and graphs in larger mixed-language CMake-driven projects, where fpm-based graph generation is not always applicable.
a Python parser that scans Fortran source files (single files or recursively through a tree) and produces a JSON representation of the dependency graph
a standalone HTML app that loads that JSON for interactive visualization, and also supports lightweight in-browser graph building/parsing from pasted USE statements
I kept the parser and viewer separate so the visualization layer can be reused with other datasets as well.
The parser is intentionally lightweight, so I expect it to miss edge cases and more complex constructs. Still, it has already been useful for my own project and workflow, and I’m sharing it in case it helps others.
Hi @Holmz, I did start with FORD, which unfortunately failed in my case due to a “circular dependency” error I could not fix. At that time, I was fairly new to Fortran and was not familiar with this discourse group, so avoiding FORD was easier for me - someone may know a way to get around circular dependencies in FORD, maybe(?)
PS. In retrospect, and based on their documentation, I think both FORD and the above fpm-modules provide similar (and perhaps enhanced and more mature) functionality for Fortran codebases. This graph tool was designed to handle cases where the codebase includes code written in multiple languages (C, Fortran, and Python in my case). This might be the only real comparison (unless I missed anything)…
Does this require updating the .json file? i followed the intructions and got the pretty visualization of the sample_example. however for my own project i could not figure out how i can upload the files in the html?