appyter.ext.nbclient package¶
Module contents¶
- class appyter.ext.nbclient.NotebookClientIOPubHook(**kwargs: Any)[source]¶
Bases:
NotebookClient
A notebook client with the ability to hook into iopub updates
- async async_execute_cell(cell: NotebookNode, cell_index: int, execution_count: int | None = None, store_history: bool = True) NotebookNode [source]¶
Executes a single code cell.
To execute all cells see
execute()
.Parameters¶
- cellnbformat.NotebookNode
The cell which is currently being processed.
- cell_indexint
The position of the cell within the notebook object.
- execution_countint
The execution count to be assigned to the cell (default: Use kernel response)
- store_historybool
Determines if history should be stored in the kernel (default: False). Specific to ipython kernels, which can store command histories.
Returns¶
- outputdict
The execution output payload (or None for no output).
Raises¶
- CellExecutionError
If execution failed and should raise an exception, this will be raised with defaults about the failure.
Returns¶
- cellNotebookNode
The cell which was just processed.
- async_setup_kernel(**kwargs) AsyncGenerator [source]¶
Context manager for setting up the kernel to execute a notebook.
This assigns the Kernel Manager (
self.km
) if missing and Kernel Client(self.kc
).When control returns from the yield it stops the client’s zmq channels, and shuts down the kernel.
- async handle_comm_msg(outs: List, msg: Dict, cell_index: int) None [source]¶
Store ipywidget state in each cell during execution and trigger iopub_hook
- async process_message(msg: Dict, cell: NotebookNode, cell_index: int) List | None [source]¶
Processes a kernel message, updates cell state, and returns the resulting output object that was appended to cell.outputs.
The input argument cell is modified in-place.
Parameters¶
- msgdict
The kernel message being processed.
- cellnbformat.NotebookNode
The cell which is currently being processed.
- cell_indexint
The position of the cell within the notebook object.
Returns¶
- outputdict
The execution output payload (or None for no output).
Raises¶
- CellExecutionComplete
Once a message arrives which indicates computation completeness.