Configuration (ipyflow.config)

ipyflow’s per-session behavior is governed by a handful of enums and the MutableDataflowSettings dataclass that holds them. Each enum has a default (used when an unrecognized value is supplied) and a corresponding %flow subcommand.

Settings can be changed at runtime with the %flow magic (The %flow magic), read or written on flow().mut_settings, or set as defaults in your IPython profile via c.ipyflow.<name> = ....

Enum ↔ %flow subcommand

Enum

Default

%flow subcommand

ExecutionMode

lazy

%flow mode [lazy|reactive]

ExecutionSchedule

dag_based

%flow schedule [liveness_based|dag_based|hybrid_dag_liveness_based]

FlowDirection

in_order

%flow direction [in_order|any_order]

ReactivityMode

batch

%flow reactivity [batch|incremental]

Highlights

executed

%flow hls [all|none|executed|reactive] / %flow nohls

Enums

class ipyflow.config.ExecutionMode(*values)[source]

Whether executing a cell also re-runs its stale dependencies.

Set with %flow mode. LAZY is the default and matches stock ipykernel (only the executed cell runs); REACTIVE additionally re-runs stale upstream and downstream cells in dependency order.

LAZY = 'lazy'
REACTIVE = 'reactive'
class ipyflow.config.ExecutionSchedule(*values)[source]

How the set of cells to (re-)run is computed.

Set with %flow schedule. DAG_BASED (the default) uses the dynamic dataflow graph; LIVENESS_BASED uses static liveness analysis of cell source; HYBRID_DAG_LIVENESS_BASED combines both and is required for incremental reactivity.

LIVENESS_BASED = 'liveness_based'
DAG_BASED = 'dag_based'
HYBRID_DAG_LIVENESS_BASED = 'hybrid_dag_liveness_based'
class ipyflow.config.FlowDirection(*values)[source]

Which dependency edges may drive reactive execution.

Set with %flow direction. IN_ORDER (the default) only lets a cell trigger cells that appear after it in the notebook; ANY_ORDER ignores spatial position.

ANY_ORDER = 'any_order'
IN_ORDER = 'in_order'
class ipyflow.config.ReactivityMode(*values)[source]

Whether reactive updates are applied all at once or one cell at a time.

Set with %flow reactivity. BATCH (the default) recomputes the whole affected set together; INCREMENTAL applies updates one step at a time and requires a liveness-aware ExecutionSchedule.

BATCH = 'batch'
INCREMENTAL = 'incremental'
class ipyflow.config.Highlights(*values)[source]

Which cells the frontend visually highlights.

Set with %flow hls / %flow nohls. EXECUTED (the default) highlights cells that ran; REACTIVE highlights reactive updates; ALL and NONE show everything or nothing.

ALL = 'all'
NONE = 'none'
EXECUTED = 'executed'
REACTIVE = 'reactive'

Settings

The mutable per-session settings live on flow().mut_settings. Beyond the enums above it exposes toggles such as dataflow_enabled, static_slicing_enabled, dynamic_slicing_enabled, warn_out_of_order_usages, and syntax_transforms_enabled.

class ipyflow.config.MutableDataflowSettings(dataflow_enabled: bool, trace_messages_enabled: bool, highlights: ipyflow.config.Highlights, interface: ipyflow.config.Interface, static_slicing_enabled: bool, dynamic_slicing_enabled: bool, exec_mode: ipyflow.config.ExecutionMode, exec_schedule: ipyflow.config.ExecutionSchedule, flow_order: ipyflow.config.FlowDirection, reactivity_mode: ipyflow.config.ReactivityMode, push_reactive_updates: bool, push_reactive_updates_to_cousins: bool, pull_reactive_updates: bool, color_scheme: ipyflow.config.ColorScheme, warn_out_of_order_usages: bool, lint_out_of_order_usages: bool, syntax_transforms_enabled: bool, syntax_transforms_only: bool, max_external_call_depth_for_tracing: int, is_dev_mode: bool)[source]
slicing_contexts() List[SlicingContext][source]

Return the currently-enabled slicing contexts (dynamic and/or static).