puudot/code/puudot.py
Lauri Koskenniemi 93e2554457 Improved links and configuration file for dot
Restructured data to support block and node level links.
Added hidden nodes and edges in blocks to improve link
visualization.

Introduced support for configuring dot file parameters with
a config file.
2025-05-30 22:54:36 +03:00

30 lines
920 B
Python

from db import load_data, load_config
from graph import Graph
import os
DATA_DIR="/data"
CONFIG_FILE="/config.yaml"
def main():
# Get all YAML files in the data directory
yaml_files = [f for f in os.listdir(DATA_DIR) if f.endswith(('.yaml', '.yml'))]
config = load_config(CONFIG_FILE)
for yaml_file in yaml_files:
print(f"Processing {yaml_file}...")
data = load_data(os.path.join(DATA_DIR, yaml_file))
graph = Graph()
graph.set_config(config)
graph.process_blocks(data)
graph.build_dot()
# Use the base name of the YAML file (without extension) as the output name
base_name = os.path.splitext(yaml_file)[0]
dot_file = os.path.join(DATA_DIR, f"{base_name}.gv")
svg_file = os.path.join(DATA_DIR, f"{base_name}.svg")
graph.make_dot("svg", dot_file, svg_file)
if __name__ == "__main__":
main()