Reactive API (ipyflow.api)
These are the user-facing helpers re-exported at the top level of ipyflow
(from ipyflow import deps, users, code, ...). Each symbol-introspection helper
takes the value of a notebook symbol; a tracer hook resolves it to the
corresponding Symbol. See
Introspecting the dataflow graph for worked examples.
Symbol introspection
- ipyflow.api.lift.lift(sym: Any) Symbol[source]
Given the programmatic usage of some symbol, look up the corresponding Symbol metadata.
- ipyflow.api.lift.code(sym: Any, **kwargs: Any) HTML | str[source]
Given the programmatic usage of some symbol, look up the corresponding code for that symbol.
- ipyflow.api.lift.timestamp(sym: Any) Timestamp[source]
Given the programmatic usage of some symbol, look up the corresponding timestamp for that symbol.
- ipyflow.api.lift.deps(sym: Any) List[Symbol][source]
Given the programmatic usage of some symbol, look up the corresponding dependencies for that symbol.
- ipyflow.api.lift.users(sym: Any) List[Symbol][source]
Given the programmatic usage of some symbol, look up the corresponding users of that symbol.
- ipyflow.api.lift.rdeps(sym: Any) List[Symbol][source]
Given the programmatic usage of some symbol, look up the corresponding recursive dependencies for that symbol.
- ipyflow.api.lift.rusers(sym: Any) List[Symbol][source]
Given the programmatic usage of some symbol, look up the corresponding users of that symbol.
- ipyflow.api.lift.watchpoints(sym: Any) Watchpoints[source]
Given the programmatic usage of some symbol, look up the corresponding watchpoints for that symbol.
Cell output recovery
- ipyflow.api.cells.stdout(ts_or_cell_num: int | Timestamp) str | None[source]
Return the stdout captured during a cell’s execution.
- Parameters:
ts_or_cell_num – a cell execution counter, or a
Timestamp(whosecell_numis used).- Returns:
the captured stdout as a string, or
Noneif the cell produced no captured output.- Raises:
ValueError – if no cell with that counter has executed yet.
- ipyflow.api.cells.stderr(ts_or_cell_num: int | Timestamp) str | None[source]
Return the stderr captured during a cell’s execution.
- Parameters:
ts_or_cell_num – a cell execution counter, or a
Timestamp(whosecell_numis used).- Returns:
the captured stderr as a string, or
Noneif the cell produced no captured output.- Raises:
ValueError – if no cell with that counter has executed yet.
- ipyflow.api.cells.reproduce_cell(ctr: int, show_input: bool = True, show_output: bool = True, lookback: int = 0)[source]
Re-render the input and/or output of a previous cell execution.
Because ipyflow captures each cell’s output, this can recover results that autosave (for example, a reactive re-run) has since overwritten – within the current kernel session.
- Parameters:
ctr – the execution counter of the cell to reproduce.
show_input – whether to render the cell’s input source.
show_output – whether to render the cell’s captured output.
lookback – how many executions to step back for this cell.
0(the default) is the latest execution;1is the one before it, and so on – useful for recovering a result a later re-execution replaced.