3 ms·
I’d like to write some scripts that can take some of my code and produce a graph of it. Things I’d like is for example to draw a GCP cloud build file, or somet
by wodenokoto 6y ago
I’d like to write some scripts that can take some of my code and produce a graph of it.
Things I’d like is for example to draw a GCP cloud build file, or something like that.
What would be a good intermediate format for this? I’ll read an xml or yaml file into a python list of dicts and then loop through it and write ... Graphviz? Mermaid? Tikz?
What do you guys recommend?
- q3k 6y agoUsing graphviz for visualizing these things is fast and easy. print('digraph foo {') # adj_list contains tuples of (parent node name, child node name) for parent, child in adj_list: print(f'{parent} -> {child}') print('}') Redirect that to a file and view with `xdot`, done. I've done exactly this a few days ago to visualize the Linux build graph: https://q3k.org/u/73839114a0e5ee65002029892a069dd1b645a8f9f0b336e4cc3f622874772960.png https://q3k.org/u/73839114a0e5ee65002029892a069dd1b645a8f9f0...
- wodenokoto 6y agoSweet! It was excactly this kind of advice I was hoping to get. Thank you.