Notebook Preview

Euporie can be used to render notebooks in the terminal, which is useful for quickly previewing notebook files.

For more information about the command line options available for the preview sub-command, see the command line reference for the preview-subcommand.

User Guide

Preview a Notebook in the Terminal

To print a notebook to the terminal, run:

$ euporie-preview notebook.ipynb

Preview a Notebook in the System Pager

To view a notebook in the system pager, run:

$ euporie-preview --page notebook.ipynb

You can also pipe the output to the pager of your choice:

$ euporie-preview --color-depth=24 notebook.ipynb | bat

Note

By default euporie will select a color-depth to use which is suitable for the environment it is running in. This means if you are piping its output, the color depth will be set to 1. If your pager supports colored output, you can manually specify the color-depth with the color_depth configuration option.

Run a Notebook Before Previewing

To run a notebook before the preview is generated, use the --run flag:

$ euporie-preview --run notebook.ipynb

Preview a subset of cells

To show a subset of the cells in the notebook, the --cell-start and --cell-end flags can be used:

$ euporie-preview --cell-start=3 --cell-end=6 notebook.ipynb

Save a Notebook After Running

To save a notebook after it has been run, use the --save flag with the --run flag:

$ euporie-preview --run --save notebook.ipynb

Use as a previewer with ranger

Euporie can be used to preview notebook files in terminal file managers like ranger.

To configure ranger for this, add the following to the handle_extension function in your scope.sh file:

# ...

handle_extension() {
    case "${FILE_EXTENSION_LOWER}" in

        # ...

        ## Notebook
        ipynb)
            euporie-preview --color-depth=8 "${FILE_PATH}" && exit 4
    esac
}

# ...

You can also add the following line to your rifle.conf file if you want notebook files to open in euporie:

ext ipynb,           has euporie-notebook,      terminal = euporie-notebook "$@"

Command Line Interface

Usage

$ euporie-hub [-h] [--version] [--clipboard {external,internal,terminal}]
                   [--log-file [str]]
                   [--log-level {debug,info,warning,error,critical}]
                   [--log-config str] [--show-shadows | --no-show-shadows]
                   [--set-cursor-shape | --no-set-cursor-shape]
                   [--cursor-blink | --no-cursor-blink]
                   [--edit-mode {micro,emacs,vi}] [--tab-size int]
                   [--terminal-polling-interval int]
                   [--autoformat | --no-autoformat]
                   [--format-black | --no-format-black]
                   [--format-isort | --no-format-isort]
                   [--format-ssort | --no-format-ssort] [--syntax-theme str]
                   [--color-depth {1,4,8,24}]
                   [--tmux-graphics | --no-tmux-graphics]
                   [--color-scheme {default,inverse,light,dark,black,white,custom}]
                   [--custom-background-color str]
                   [--custom-foreground-color str] [--accent-color str]
                   [--key-bindings loads]
                   [--graphics {none,sixel,kitty,iterm}]
                   [--app {notebook,console}] [--host str] [--port int]
                   [--host-keys [UPath ...]] [--client-keys [UPath ...]]
                   [--auth | --no-auth]
                   [UPath ...]

Positional Arguments

<UPath> ...

List of file names to open

Optional Arguments

-h, --help

show this help message and exit

--version, -V

Show the version number and exit

--clipboard {external,internal,terminal}

The preferred clipboard access method

--log-file <str>

File path for logs

--log-level {debug,info,warning,error,critical}

Set the log level

--log-config <str>

Additional logging configuration

--show-shadows, --no-show-shadows

Show or hide shadows under menus and dialogs

--set-cursor-shape, --no-set-cursor-shape

Whether to set the shape of the cursor depending on the editing mode

Whether to blink the cursor

--edit-mode {micro,emacs,vi}

Key-binding mode for text editing

--tab-size <int>

Spaces per indentation level

--terminal-polling-interval <int>

Time between terminal colour queries

--autoformat, --no-autoformat

Automatically re-format code cells when run

--format-black, --no-format-black

Use black when re-formatting code cells

--format-isort, --no-format-isort

Use isort when re-formatting code cells

--format-ssort, --no-format-ssort

Use ssort when re-formatting code cells

--syntax-theme <str>

Syntax highlighting theme

--color-depth {1,4,8,24}

The color depth to use

--tmux-graphics, --no-tmux-graphics

Enable terminal graphics in tmux (experimental)

--color-scheme {default,inverse,light,dark,black,white,custom}

The color scheme to use

--custom-background-color <str>, --custom-bg-color <str>, --bg <str>

Background color for “Custom” color theme

--custom-foreground-color <str>, --custom-fg-color <str>, --fg <str>

Foreground color for “Custom” color theme

--accent-color <str>

Accent color to use in the app

--key-bindings <loads>

Additional key binding definitions

--graphics {none,sixel,kitty,iterm}

The preferred graphics protocol

--app {notebook,console}

App to run under euporie hub

--host <str>

The host address to bind to

--port <int>

The port for the ssh server to use

--host-keys <UPath> ...

Host keys to use for the SSH server

--client-keys <UPath> ...

Client public keys authorized to connect

--auth, --no-auth

Allow unauthenticated access to euporie hub


Available Commands