Docs · API reference · Verso.MagicCommands

ImportMagicCommand Class#

#!import path [--param name=value ...] [--show-output] -- reads a notebook file or source file, deserializes or parses it, resolves parameters against the imported notebook's definitions, and executes every cell whose type carries source (any type other than markdown or raw), dispatching to the kernel that handles each cell's language. Variables and state persist for subsequent cells.

By default the imported cells run silently, except that error outputs are always surfaced. Pass --show-output to surface all output each imported cell produces in the importing cell, in execution order.

Supported formats: - Notebook files (.verso, .ipynb, .dib) -- deserialized and executed cell-by-cell. - Source files (.cs, .csx, .fs, .fsx, .py, .ps1, .psm1, .js, .mjs, .ts, .tsx, .sql, etc.) -- magic commands are extracted and run in priority order (NuGet/pip first, then imports, then remaining directives), and the file's own code is then run in the kernel that owns the file extension.

An imported file may itself import another, and names it the way the two sit on disk: a path in a nested #!import is read relative to the file that wrote it, falling back to the notebook.

public sealed class ImportMagicCommand : Verso.Abstractions.IMagicCommand, Verso.Abstractions.IExtension

Inheritance System.Object → ImportMagicCommand

Implements IMagicCommand, IExtension