Define a cell object with input are and rich outputs, and related objects.


add_setting(name, default, help_, description)

Register a new config item.

cast(typ, val)

Cast a value to a type.

format_code(text, config)

Format a code string using :py:mod:``.


Get the current active (running) Application.


Return the cell ID field defined in a cell JSON object.

get_lexer_by_name(_alias, **options)

Return an instance of a Lexer subclass that has alias in its aliases list.


Get a pygments lexer class by name, ignoring errors.


Return a mouse handler which call a given function on click.


Cell(index, json, kernel_tab)

A kernel_tab cell element.

CellOutputArea(json, parent[, style])

An area below a cell where one or more cell outputs can be shown.


Turn any callable into a Filter.

ConditionalContainer(content, filter)

Wrapper around any other container that can change the visibility.


Base class for user interface layout.

Dimension([min, max, weight, preferred])

Specified dimension (width/height) of a user control or window.

Document([text, cursor_position, selection])

This is a immutable class around the text and cursor position, and contains methods for querying this data, e.g.


Lexer class that can dynamically returns any Lexer.

FormattedTextControl([text, style, ...])

Control that displays formatted text.

HSplit(children[, window_too_small, align, ...])

Several layouts, one stacked above/under the other. ::.

KernelInput(kernel_tab, *args[, ...])

Kernel input text areas.

PygmentsLexer(pygments_lexer_cls[, ...])

Lexer that calls a pygments lexer.


Lexer that doesn't do any tokenizing and returns the whole input as one token.


A widget to accept kernel input.

VSplit(children[, window_too_small, align, ...])

Several layouts, one stacked left/right of the other. ::.

Window([content, width, height, z_index, ...])

Container that holds a control.


partial(func, *args, **keywords) - new function with partial application of the given arguments and keywords.



Raised if one of the lookup functions didn't find a matching class.

class euporie.core.widgets.cell.Cell(index: int, json: dict, kernel_tab: BaseNotebook)

Bases: object

A kernel_tab cell element.

Contains a transparent clickable overlay, which is not displayed when the cell is focused.

add_output(output_json: dict[str, Any]) None

Add a new output to the cell.

property cell_type: str

Determine the current cell type.

clear_output(wait: bool = False) None

Remove the cells output, optionally when new output is generated.

async edit_in_editor() None

Edit the cell in $EDITOR.

property execution_count: str

Retrieve the execution count from the cell’s JSON.

focus(position: int | None = None, scroll: bool = False) None

Focus the relevant control in this cell.

  • position – An optional cursor position index to apply to the input box

  • scroll – Whether to scroll the page to make the selection visible

property focused: bool

Determine if the cell currently has focus.

get_input(prompt: str = 'Please enter a value:', password: bool = False) None

Scroll the cell requesting input into view and render it before asking for input.

hide_input() None

Set the cell inputs to visible.

hide_output() None

Set the cell outputs to visible.

property id: str

Return the cell’s ID as per the cell JSON.

property input: str

Fetch the cell’s contents from the cell’s JSON.

input_box: KernelInput
property language: str

Return the cell’s code language.

property output_json: list[dict[str, Any]]

Retrieve a list of cell outputs from the cell’s JSON.

property prompt: str

Determine what should be displayed in the prompt of the cell.

ran(content: dict | None = None) None

Update the cell status and update display when the cell has finished.

reformat() None

Reformat the cell’s input.

refresh(now: bool = True) None

Request that the cell to be re-rendered next time it is drawn.

remove_outputs() None

Remove all outputs from the cell.

run_or_render(buffer: Buffer | None = None, wait: bool = False, callback: Callable[..., None] | None = None) bool

Send the cell’s source code the the kernel to run.

  • buffer – Unused parameter, required when accepting the contents of a cell’s input buffer

  • wait – Has no effect

  • callback – Callable to run when the kernel has finished running the cell


Always returns True

property selected: bool

Determine if the cell currently is selected.

set_cell_type(cell_type: Literal['markdown', 'code', 'raw'], clear: bool = False) None

Convert the cell to a different cell type.

  • cell_type – The desired cell type.

  • clear – If True, cell outputs will be cleared

set_execution_count(n: int) None

Set the execution count of the cell.

set_metadata(path: tuple[str, ...], data: Any) None

Set a value in the metadata at an arbitrary path.

  • path – A tuple of path level names to create

  • data – The value to add

set_status(status: str) None

Set the execution status of the cell.

show_input() None

Set the cell inputs to visible.

show_output() None

Set the cell outputs to visible.

property tempfile_suffix: str

Return the file suffix matching the current cell type.

toggle_input() None

Toggle the visibility of the cell input.

toggle_output() None

Toggle the visibility of the cell outputs.

euporie.core.widgets.cell.get_cell_id(cell_json: dict) str

Return the cell ID field defined in a cell JSON object.

If no cell ID is defined (as per `:mod:`nbformat`<4.5), then one is generated and added to the cell.


cell_json – The cell’s JSON object as a python dictionary


The ID string

euporie.core.widgets.cell.get_pygments_lexer(language: str) Lexer

Get a pygments lexer class by name, ignoring errors.