Problem
qdk.widgets.Circuit / qsharp-widgets renders circuit JSON as an interactive SVG, but it does not expose a supported Python or command-line path to export that SVG (or a PNG) without a notebook, browser, or editor UI.
QDK/Chemistry needs stable static circuit assets for documentation. Its molecular-QPE tutorial currently maintains SVGs copied from the rendered widget DOM. That preserves semantic circuit structure, but the workflow is manual and difficult to regenerate consistently when circuit data or renderer output changes.
Desired outcome
Provide a deterministic, headless export API owned by QDK, for example an API that accepts the same circuit representation used by Circuit and returns SVG text or writes an SVG file.
The export should:
- contain no widget controls, drop zones, editor UI, or browser chrome;
- preserve all wires, gate labels, nested operation labels, and natural circuit dimensions;
- support transparent and theme-aware styling;
- produce byte-identical or semantically stable output for unchanged circuit data and renderer versions;
- permit multiple circuits to be aligned consistently for comparison; and
- avoid requiring a browser dependency in downstream packages at runtime.
A PNG export could be useful as an additional option, but SVG is the primary need because it preserves labels and scales cleanly.
Context
Problem
qdk.widgets.Circuit/qsharp-widgetsrenders circuit JSON as an interactive SVG, but it does not expose a supported Python or command-line path to export that SVG (or a PNG) without a notebook, browser, or editor UI.QDK/Chemistry needs stable static circuit assets for documentation. Its molecular-QPE tutorial currently maintains SVGs copied from the rendered widget DOM. That preserves semantic circuit structure, but the workflow is manual and difficult to regenerate consistently when circuit data or renderer output changes.
Desired outcome
Provide a deterministic, headless export API owned by QDK, for example an API that accepts the same circuit representation used by
Circuitand returns SVG text or writes an SVG file.The export should:
A PNG export could be useful as an additional option, but SVG is the primary need because it preserves labels and scales cleanly.
Context
qsharp_widgets.Circuit, re-exported asqdk.widgets.Circuit