quantcore_circuits.review.server

Live dashboard backend: serves the React app (reviewer/ → review/static) and the run state.

API (contract: reviewer/contract/state.ts):

  • GET  /api/state — build/<design>/state.json (a fresh state is created from the design if missing)

  • GET  /api/events — Server-Sent Events: event: state whenever state.json changes, a ping every 15 s

  • GET  /files/<p> — files inside the run directory (screenshots under shots/)

  • POST /api/rebuild — rebuild the layout, write the OAS (+ klive if KLayout is open), headless screenshot, update the Layout step

Standard library only; binds to localhost.

Attributes

Functions

live_run_dir(root[, run]) → pathlib.Path | None

The run directory to show: root/<run> if named, else the one root/_live.json points at (the run that

make_handler(run_dir, design_source[, root])

run_dir: a Path (one run) or a callable returning the current run directory (or None): follow mode.

rebuild_layout(run, design_source) → dict

Build → OAS (+ sidecar) → klive (if available) → headless KLayout screenshot → state.

serve(design[, port, open_browser, run_dir, background])

Serve the dashboard for design on http://127.0.0.1:port. background=True returns the server

serve_live([root, run, port, open_browser, background])

Serve the dashboard in follow mode: it shows the run named run, or (default) whichever run saw the latest

waiting_state(root) → dict

What the dashboard shows before any run exists (follow mode): an empty state that says what to do.

Module Contents

quantcore_circuits.review.server.live_run_dir(root: pathlib.Path, run: str | None = None) → pathlib.Path | None

The run directory to show: root/<run> if named, else the one root/_live.json points at (the run that saw the latest tracked event), else the most recently updated root/*/state.json.

quantcore_circuits.review.server.make_handler(run_dir, design_source, root: pathlib.Path | None = None)

run_dir: a Path (one run) or a callable returning the current run directory (or None): follow mode.

quantcore_circuits.review.server.rebuild_layout(run, design_source) → dict

Build → OAS (+ sidecar) → klive (if available) → headless KLayout screenshot → state.

quantcore_circuits.review.server.serve(design, port: int = 8765, open_browser: bool = True, run_dir: str | pathlib.Path | None = None, background: bool = False)

Serve the dashboard for design on http://127.0.0.1:port. background=True returns the server (running in a daemon thread) instead of blocking, for use from Jupyter.

quantcore_circuits.review.server.serve_live(root: str | pathlib.Path | None = None, run: str | None = None, port: int = 8765, open_browser: bool = True, background: bool = False)

Serve the dashboard in follow mode: it shows the run named run, or (default) whichever run saw the latest tracked event (<root>/_live.json, written by quantcore_circuits.track.start()), switching by itself when a notebook moves on to another design. Same API as serve().

quantcore_circuits.review.server.waiting_state(root: pathlib.Path) → dict

What the dashboard shows before any run exists (follow mode): an empty state that says what to do.

quantcore_circuits.review.server.STATIC