Skip to content

Support deterministic headless SVG export from Circuit data #3632

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions