euporie.core.tabs.console
Contains the Console tab base class.
Functions
|
A decorator indicating abstract methods. |
|
Suspend the current app and edit a file in an external editor. |
|
Get a command from the centralized command system by name. |
|
Enable when this buffer has the focus. |
|
Create a new notebook, without validation. |
Classes
|
Base class for Consoles. |
|
The core data structure that holds the text and cursor position of the current input line and implements all text manipulations on top of it. |
|
Turn any callable into a Filter. |
|
Simple event to which event handlers can be attached. For instance::. |
|
Kernel input text areas. |
|
A Tab which connects to a kernel. |
|
Validate kernel input using a kernel code completeness call. |
A container for a set of key bindings. |
|
|
An LSP client's representation of a cell. |
|
|
Typed dictionary for named message callbacks. |
|
|
Class for storing a diagnostic report. |
|
A widget to accept kernel input. |
|
|
|
The validation state of a buffer. |
|
Create a new function with partial application of the given arguments and keywords. |
- class euporie.core.tabs.console.BaseConsole(app: BaseApp, path: Path | None = None, use_kernel_history: bool = True, connection_file: Path | None = None)
Bases:
KernelTabBase class for Consoles.
Provides common functionality for console implementations, including input validation, code execution, and kernel interaction.
- bg_init = False
- change_kernel(msg: str | None = None, startup: bool = False) None
Prompt the user to select a new kernel.
- abstractmethod clear_output(wait: bool = False) None
Remove the last output, optionally when new output is generated.
- Parameters:
wait – If True, clear output when new output is generated.
- 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
- init_kernel(kernel: BaseKernel | 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.
- input_box: KernelInput
- 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.
- lang_file_ext() str
Return the file extension for scripts in the notebook’s language.
- Returns:
The file extension including the leading dot.
- abstractmethod new_input(input_json: dict[str, Any], own: bool, force: bool = False) None
Create new cell inputs in response to kernel
execute_inputmessages.- Parameters:
input_json – The input data from the kernel message.
own – Whether this input originated from this console.
force – Whether to force rendering even if it’s our own input.
- abstractmethod new_output(output_json: dict[str, Any], own: bool) None
Handle new output from the kernel.
- Parameters:
output_json – The output data from the kernel message.
own – Whether this output originated from this console.
- prompt(text: str, count: int | None = None, offset: int = 0, show_busy: bool = False) StyleAndTextTuples
Determine what should be displayed in the prompt of the cell.
- abstractmethod refresh(now: bool = True) None
Request the output is refreshed (refresh the whole app).
- abstractmethod run(buffer: Buffer | None = None) None
Run the code in the input box.
- Parameters:
buffer – The buffer containing the code to run. If None, uses the current input buffer.
- set_kernel_info(info: dict) None
Receive and process kernel metadata.
- Parameters:
info – Kernel information dictionary.
- abstractmethod set_next_input(text: str, replace: bool = False) None
Set the text for the next prompt.
- Parameters:
text – The text to set in the input.
replace – Whether to replace existing text.