euporie.core.tabs.notebook
Contain the main class for a notebook file.
Functions
|
A decorator indicating abstract methods. |
|
Register a new config item. |
|
Suspend the current app and edit a file in an external editor. |
|
Return the cell ID field defined in a cell JSON object. |
|
Get a command from the centralized command system by name. |
|
Create a new object respsenting a Comm. |
|
Read a notebook from a file name or a file object |
Decode bytes encoded with the standard Base64 alphabet. |
|
|
Write a notebook to a file name or a file object |
Classes
|
Metaclass for defining Abstract Base Classes (ABCs). |
|
The main notebook container class. |
|
A kernel_tab cell element. |
|
A Tab which connects to a kernel. |
Typed dictionary for named message callbacks. |
|
|
Never enable feature. |
|
A path for untitled files, as needed for LSP servers. |
|
A decorator indicating abstract properties. |
partial(func, *args, **keywords) - new function with partial application of the given arguments and keywords. |
- class euporie.core.tabs.notebook.BaseNotebook(app: BaseApp, path: Path | None = None, kernel: Kernel | None = None, comms: dict[str, Comm] | None = None, use_kernel_history: bool = False, json: dict[str, Any] | None = None)
Bases:
KernelTab
The main notebook container class.
- bg_init = True
- change_kernel(msg: str | None = None, startup: bool = False) None
Prompt the user to select a new kernel.
- close(cb: Callable | None = None) None
Check if the user want to save an unsaved notebook, then close the file.
- Parameters:
cb – A callback to run if after closing the notebook.
- comm_open(content: dict, buffers: Sequence[bytes]) None
Register a new kernel Comm object in the notebook.
- container: AnyContainer
- property current_input: KernelInput
Return the currently active kernel input, if any.
- default_callbacks: MsgCallbacks
- edit_mode = False
- get_cell_by_id(cell_id: str) euporie.core.widgets.cell.Cell | None
Return a reference to the Cell container with a given cell id.
- init_kernel(kernel: Kernel | None = None, comms: dict[str, Comm] | None = None, use_kernel_history: bool = False, connection_file: Path | None = None) None
Set up the tab’s kernel and related components.
- property kernel_display_name: str
Return the display name of the kernel defined in the notebook JSON.
- property kernel_lang_file_ext: str
Return the display name of the kernel defined in the notebook JSON.
- kernel_started(result: dict[str, Any] | None = None) None
Task to run when the kernel has started.
- abstract load_container() AnyContainer
Abcract method for loading the notebook’s main container.
- new_output_default(output_json: dict[str, Any], own: bool) None
Add a new output without a cell to the currently selected cell.
- rendered_cells() list[euporie.core.widgets.cell.Cell]
Return a list of rendered notebooks’ cells.
- reports: WeakKeyDictionary[LspClient, Report]
- run_cell(cell: Cell, wait: bool = False, callback: Callable[..., None] | None = None) None
Run a cell.
- Parameters:
cell – The rendered cell to run. If
None
, runs the currently selected cell.wait – If
True
, blocks until cell execution is finishedcallback – Function to run after completion
- save(path: Path | None = None, cb: Callable | None = None) None
Write the notebook’s JSON to the current notebook’s file.
Additionally save the widget state to the notebook metadata.
- Parameters:
path – An optional new path at which to save the tab
cb – A callback to run if after saving the notebook.
- select(cell_index: int, extend: bool = False, position: int | None = None, scroll: bool = False) None
Select a cell.
- suggester: AutoSuggest