Kernel Types
nteract Desktop supports multiple kernel types through Jupyter’s standard protocol:Python Kernels
Python kernels useipykernel and support the full Jupyter messaging protocol.
Launch command:
- Code execution
- Rich output (HTML, images, plots)
- Interactive widgets (ipywidgets)
- Magic commands (
%matplotlib,%timeit, etc.) - Completion and inspection
Deno Kernels
Deno kernels enable TypeScript/JavaScript execution with built-in TypeScript support. Launch command:- TypeScript and JavaScript
- URL imports
- Top-level await
- Built-in testing and benchmarking
- Secure by default (explicit permissions)
Kernel Lifecycle
Startup Sequence
Connection File
The kernel and client communicate via ZeroMQ sockets. Connection details are stored in a JSON file:- shell: Request/reply for code execution, completion, inspection
- iopub: Broadcasts for output, status, execution counts
- stdin: Prompts for user input (e.g.,
input()in Python) - control: Interrupt and shutdown commands
- hb: Heartbeat for liveness checks
Execution Modes
nteract Desktop supports two kernel execution modes:Standard Mode (Default)
The notebook app owns the kernel process directly.- Kernel lifecycle tied to window
- Closing window terminates kernel
- Each window has independent kernel state
- Full widget support
Daemon Mode (Experimental)
The daemon owns kernel processes. Windows are thin views.- Kernels survive window closes
- Multi-window kernel sharing
- Outputs persist in daemon
- Project file auto-detection
daemon_execution: true
Jupyter Protocol
Message Types
Shell Channel (Request/Reply)
| Message Type | Purpose |
|---|---|
execute_request | Run code |
complete_request | Tab completion |
inspect_request | Object introspection |
kernel_info_request | Kernel metadata |
is_complete_request | Check if code is complete |
interrupt_request | Interrupt execution |
shutdown_request | Shutdown kernel |
IOPub Channel (Broadcast)
| Message Type | Purpose |
|---|---|
stream | stdout/stderr output |
display_data | Rich display outputs |
execute_result | Return value of executed code |
error | Exception tracebacks |
execute_input | Echo of executed code |
status | Kernel state (idle/busy/starting) |
clear_output | Clear cell outputs |
Comm Protocol (Widgets)
| Message Type | Purpose |
|---|---|
comm_open | Establish widget communication |
comm_msg | Widget state updates |
comm_close | Close widget channel |
Message Structure
All Jupyter messages follow this structure:Kernel State Management
Execution Queue
Cells are queued for execution in order:- Idle → Cell waiting to execute
- Queued → Cell in execution queue
- Executing → Kernel actively running cell
- Complete → Execution finished (success or error)
Interrupt
Interrupt the currently executing cell:KeyboardInterrupt. Deno kernels terminate the current execution.
Restart
Restart the kernel to clear state:- Shutdown current kernel process
- Spawn new kernel with same connection file
- Reconnect ZMQ channels
- Reinitialize kernel state
Restarting clears all variables, imports, and execution history. Outputs in cells are preserved.
Environment Source Labels
The daemon returns anenv_source string with the kernel:lifecycle event indicating where the environment came from:
UV environments:
uv:inline— Inline dependencies from notebook metadatauv:pyproject— Project’spyproject.tomluv:prewarmed— Prewarmed pool environment
conda:inline— Inline dependencies from notebook metadataconda:env_yml— Project’senvironment.ymlconda:pixi— Project’spixi.tomlconda:prewarmed— Prewarmed pool environment
Widget Support
Interactive widgets (ipywidgets) enable rich UI controls in notebooks.Widget Architecture
Comm Message Routing
Standard mode:comm_open, comm_msg, and comm_close messages bidirectionally.
Widget State Persistence
Widget state is stored in notebook metadata:Monitoring Kernels
List Running Kernels
List Notebook Kernels
- Notebook path or ID
- Kernel type (python/deno)
- Environment source
- Kernel status (idle/busy)
- Number of connected peers
Daemon Logs
- Launch commands
- Environment detection
- ZMQ connection status
- Execution queue state
- Output handling
Performance Considerations
Prewarmed Environments
Prewarmed pools make kernel startup nearly instant:- Cold start (no pool): 5-10 seconds
- Warm start (from pool): <1 second
Output Handling
Large outputs are stored in the blob store to avoid CRDT bloat:- Small outputs (<8KB): Inlined in Automerge doc
- Large outputs (≥8KB): Stored as blobs, hash in doc
Execution Latency
Message round-trip times:- Local ZMQ: <1ms
- Execute request → first output: ~5-20ms
- Multi-window sync: <50ms
Troubleshooting
Kernel won't start
Kernel won't start
Check daemon logs for errors:Common issues:
- Environment not found or corrupted
- Port conflicts (rare, ports are randomized)
- Python/Deno not in PATH
- Permission issues with connection file
Kernel stuck in 'busy' state
Kernel stuck in 'busy' state
The kernel is executing code or waiting for input.Solutions:
- Click the interrupt button to stop execution
- Check for
input()calls requiring stdin - Restart the kernel if truly stuck
Widgets not rendering
Widgets not rendering
Standard mode:
- Ensure
ipywidgetsis installed in the environment - Check browser console for JavaScript errors
- Widgets only work in the window that created them (known limitation)
- Switch to standard mode for full widget support
Outputs disappear after restart
Outputs disappear after restart
Restarting the kernel clears execution state but preserves outputs in cells.If outputs are missing:
- They may have been cleared before restart
- Check if the notebook was saved with outputs
- In daemon mode, outputs persist in the Automerge doc even across restarts
Next Steps
Environments
Learn about environment management
Daemon
Understand the daemon’s role
Notebooks
Explore notebook format
Synchronization
Deep dive into CRDT sync