quantcore_circuits.assembly.last_good

Last good routes: what a route looked like the last time it built.

A qcc build --keep-going (the KLayout plugin’s builds) leaves a failed route out of the layout. So that nothing downstream loses it, every successful keep-going build stores each route’s polyline and length in <name>.last_good_routes.json next to the layout; a route that builds again replaces its entry, a route that fails keeps the old one. The sidecar’s failed_routes carries the entry of each failed route, the plugin draws it, and the LOM (lom_from_design) uses it, with a warning, instead of the missing route.

Strict builds (scripts, notebooks, tests, fab export) never read or write this file.

Attributes

Functions

design_store_path(design_path) → pathlib.Path

Where the plugin's builds of a design file keep it: <design dir>/build/<design stem>....

entry_of(rp, route) → dict

What is stored of a built route: its sharp polyline, length and CPW, enough to stand in for it.

load(path) → dict

{route: entry} of a store file; empty when there is none (or it cannot be read).

plan_for_lom(design[, source])

The build plan the LOM reads. A design file whose plugin builds stored last good routes beside the layout

resolve(plan)

plan with each failed route replaced by its last good route (a copy; plan itself is not changed), for

standin(name, entry[, defaults]) → quantcore_circuits.route.router.RoutePlan

A RoutePlan rebuilt from a stored entry (not drawn: used where a length / width is needed).

store_path(layout_path) → pathlib.Path

<layout stem>.last_good_routes.json beside the layout.

update(path, plan[, previous]) → dict

Write the store after a keep-going build: the routes of the design, as they built now, or as they last built

Module Contents

quantcore_circuits.assembly.last_good.design_store_path(design_path: str | pathlib.Path) → pathlib.Path

Where the plugin’s builds of a design file keep it: <design dir>/build/<design stem>....

quantcore_circuits.assembly.last_good.entry_of(rp: quantcore_circuits.route.router.RoutePlan, route) → dict

What is stored of a built route: its sharp polyline, length and CPW, enough to stand in for it.

quantcore_circuits.assembly.last_good.load(path: str | pathlib.Path | None) → dict

{route: entry} of a store file; empty when there is none (or it cannot be read).

quantcore_circuits.assembly.last_good.plan_for_lom(design, source=None)

The build plan the LOM reads. A design file whose plugin builds stored last good routes beside the layout (build/<stem>.last_good_routes.json) is planned with keep_going: a failed route is replaced by its last good one with a warning (resolve()). Everything else is the strict plan, which raises on a failed route.

quantcore_circuits.assembly.last_good.resolve(plan)

plan with each failed route replaced by its last good route (a copy; plan itself is not changed), for the LOM and other readers of route lengths. Each replacement is named in plan.warnings and in a Python warning. A failed route without a last good one raises RoutingError naming it. Plans without failures come back as they are.

quantcore_circuits.assembly.last_good.standin(name: str, entry: dict, defaults: dict | None = None) → quantcore_circuits.route.router.RoutePlan

A RoutePlan rebuilt from a stored entry (not drawn: used where a length / width is needed).

quantcore_circuits.assembly.last_good.store_path(layout_path: str | pathlib.Path) → pathlib.Path

<layout stem>.last_good_routes.json beside the layout.

quantcore_circuits.assembly.last_good.update(path: str | pathlib.Path, plan, previous: dict | None = None) → dict

Write the store after a keep-going build: the routes of the design, as they built now, or as they last built (previous, or what the file holds) when they failed now. Returns the new {route: entry}.

quantcore_circuits.assembly.last_good.SCHEMA = 'qcc-last-good-routes/0.1'