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] [--host str] [--port int] [--host-keys [UPath ...]]
[--client-keys [UPath ...]] [--auth | --no-auth]
[--log-file [str]]
[--log-level {debug,info,warning,error,critical}]
[--log-config loads]
[--clipboard {external,internal,terminal}]
[--edit-mode {micro,emacs,vi}] [--tab-size int]
[--terminal-polling-interval float] [--formatters loads]
[--syntax-highlighting | --no-syntax-highlighting]
[--syntax-theme str] [--color-depth {1,4,8,24}]
[--color-scheme {default,inverse,light,dark,black,white,custom}]
[--custom-background-color str]
[--custom-foreground-color str] [--accent-color str]
[--custom-styles loads] [--key-bindings loads]
[--graphics {none,sixel,kitty,kitty-unicode,iterm}]
[--force-graphics | --no-force-graphics]
[--enable-language-servers | --lsp | --no-enable-language-servers | --no-lsp]
[--language-servers loads]
[--set-cursor-shape | --no-set-cursor-shape]
[--cursor-blink | --no-cursor-blink]
[--recent-files [UPath ...]] [--warn-venv | --no-warn-venv]
[--line-numbers | --no-line-numbers]
[--relative-line-numbers | --no-relative-line-numbers]
[--autoformat | --no-autoformat]
[--autocomplete | --no-autocomplete]
[--autosuggest {smart,simple,none}]
[--show-status-bar | --no-show-status-bar]
[--show-shadows | --no-show-shadows]
{console,edit,notebook,preview} [UPath ...]
Positional Arguments
- {console,edit,notebook,preview}
The application to launch
- <UPath> ...
List of file names to open
Optional Arguments
- -h, --help
show this help message and exit
- --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
- --version, -V
==SUPPRESS==
- --log-file <str>
File path for logs
- --log-level {debug,info,warning,error,critical}
Set the log level
- --log-level-stdout {debug,info,warning,error,critical}
==SUPPRESS==
- --log-config <loads>
Additional logging configuration
- --clipboard {external,internal,terminal}
The preferred clipboard access method
- --edit-mode {micro,emacs,vi}
Key-binding mode for text editing
- --tab-size <int>
Spaces per indentation level
- --terminal-polling-interval <float>
Time between terminal colour queries
- --formatters <loads>
List of external code formatters
- --syntax-highlighting, --no-syntax-highlighting
Syntax highlighting
- --syntax-theme <str>
Syntax highlighting theme
- --color-depth {1,4,8,24}
The color depth to use
- --multiplexer-passthrough, --no-multiplexer-passthrough
==SUPPRESS==
- --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
- --custom-styles <loads>
Additional style settings
- --key-bindings <loads>
Additional key binding definitions
- --graphics {none,sixel,kitty,kitty-unicode,iterm}
The preferred graphics protocol
- --force-graphics, --no-force-graphics
Force use of specified graphics protocol
- --enable-language-servers, --lsp, --no-enable-language-servers, --no-lsp
Enable language server support
- --language-servers <loads>
Language server configurations
- --set-cursor-shape, --no-set-cursor-shape
Whether to set the shape of the cursor depending on the editing mode
- --cursor-blink, --no-cursor-blink
Whether to blink the cursor
- --recent-files <UPath> ...
List of recently opened files
- --warn-venv, --no-warn-venv
Warn when running in a virtual environment
- --line-numbers, --no-line-numbers
Show or hide line numbers
- --relative-line-numbers, --no-relative-line-numbers
Use relative line numbers
- --autoformat, --no-autoformat
Automatically re-format code cells when run
- --autocomplete, --no-autocomplete
Provide completions suggestions automatically
- --autosuggest {smart,simple,none}
Provide line completion suggestions
- --show-status-bar, --no-show-status-bar
Show the status bar
- --show-shadows, --no-show-shadows
Show or hide shadows under menus and dialogs