mimiqcircuits.backends.progress

Progress reporting for LocalBackend.execute().

Mirrors the AbstractProgress sink in Julia AbstractQCSs.jl. The execute driver and backends open named stages and advance them; the concrete sink decides whether and how to render. NoProgress is the zero-cost default; TqdmProgress draws bars with tqdm.

A sink is driven through three verbs, all no-ops on NoProgress:

  • progress.stage(name, total=...) opens a bar and returns a stage.

  • stage.step(n=1) advances it.

  • stage.finish() closes it.

The driver owns the trajectory bar and, on the single-evolve path, an execution bar fed by the backend’s per-step callback. A backend with a countable compression step emits its own stage by overriding LocalBackend.compile_progress().

Functions

execution_progress_callback(progress, user, box)

Wrap a per-step callback so the execution bar advances on each step the backend reports, then forwards to user unchanged.

to_progress(progress)

Normalise the user-facing progress= argument: a Progress passes through, a bool selects between TqdmProgress and NoProgress.

Classes

NoProgress()

Default sink: every verb is a no-op, so threading progress through the pipeline costs nothing when reporting is disabled.

Progress()

Sink for execution progress.

Stage()

A single progress bar opened by Progress.stage().

TqdmProgress(*[, leave])

Render stages as tqdm bars.

class mimiqcircuits.backends.progress.Stage[source]

Bases: ABC

A single progress bar opened by Progress.stage().

abstract step(n=1)[source]
abstract finish()[source]
class mimiqcircuits.backends.progress.Progress[source]

Bases: ABC

Sink for execution progress.

abstract stage(name, *, total=None)[source]

Open a stage named name. total=None means the length is unknown and the bar shows an indeterminate count.

class mimiqcircuits.backends.progress.NoProgress[source]

Bases: Progress

Default sink: every verb is a no-op, so threading progress through the pipeline costs nothing when reporting is disabled.

stage(name, *, total=None)[source]

Open a stage named name. total=None means the length is unknown and the bar shows an indeterminate count.

class mimiqcircuits.backends.progress.TqdmProgress(*, leave=False)[source]

Bases: Progress

Render stages as tqdm bars. leave=False clears each bar once its stage finishes so sequential stages do not pile up.

__init__(*, leave=False)[source]
stage(name, *, total=None)[source]

Open a stage named name. total=None means the length is unknown and the bar shows an indeterminate count.

mimiqcircuits.backends.progress.to_progress(progress)[source]

Normalise the user-facing progress= argument: a Progress passes through, a bool selects between TqdmProgress and NoProgress.

mimiqcircuits.backends.progress.execution_progress_callback(progress, user, box)[source]

Wrap a per-step callback so the execution bar advances on each step the backend reports, then forwards to user unchanged.

Backends report a step by calling callback(i, total): i is the 1-based step index and total the step count (or None when unknown). The stage is opened lazily on the first step so its total comes from the backend. box is a one-element list that receives the stage so the driver can close it once evolution returns.