Support deterministic headless SVG export from Circuit data
- Dominant language
- Rust
- Stars
- 1k
- Forks
- 212
- Avg merge
- 3d 8h
- Merged PRs (30d)
- 65
Description
## 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
- Downstream tracking issue: microsoft/qdk-chemistry#628
- Existing theme-aware chemistry-course assets: #3631
- Current Python wrapper: `qsharp_widgets.Circuit`, re-exported as `qdk.widgets.Circuit`
Contributor guide
Assessment
This issue has not been assessed yet.