Skip to content

Issue 5: PNG generation is a side effect of build_graph() #6

@sanjaigridsandguides

Description

@sanjaigridsandguides

Problem

  • build_graph() writes graph_image.png to disk before returning the compiled graph.
  • graph.py calls faq_graph = build_graph() at module top level.
  • Every import of graph regenerates the PNG.

Impact

  • Adds latency to every run (including unit tests).
  • A failure in draw_mermaid_png() would prevent the module from importing at all.

Required Fix

  • Move the PNG render to a separate function or to if __name__ == "__main__":.
  • Don't run side-effecting I/O inside a constructor function named build_graph.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions