Case-insensitive diagram options are passed to Graphviz without normalization
Author: xu91102Created Sep 26, 2026Updated Sep 26, 2026
Problem
Diagram accepts case-insensitive direction and curve-style options, but writes their original spelling to Graphviz. For example, direction="lr" and curvestyle="CURVED" pass validation but produce rankdir=lr and splines=CURVED instead of Graphviz's canonical LR and curved values. This can silently use a different layout/routing than requested.
Reproduction
On master 0cd0d84016087eead0f7a5b747571b3f92b56726, Python 3.12:
from diagrams import Diagram
diagram = Diagram(direction="lr", curvestyle="CURVED", show=False)
print(diagram.dot.graph_attr["rankdir"]) # lr
print(diagram.dot.graph_attr["splines"]) # CURVEDExpected: LR and curved, matching the case-insensitive validation already covered by the existing tests.
A minimal fix is to normalize these two values after validation and before putting them into the graph attributes. Explicit graph_attr overrides can retain their existing behavior.
Source: mingrammer/diagrams