Jupyter Integration
Installation
pip install niki[jupyter]Quick Start
# Load the extension%load_ext niki
# Monitor a cell%%niki_watchimport scanpy as scadata = sc.read_h5ad("large_dataset.h5ad")sc.pp.filter_cells(adata, min_genes=200)When the cell completes, you’ll receive a notification with:
- Execution time
- Exit status
- Captured output
- Any matplotlib figures
Named Tasks
Give cells descriptive names:
%%niki_watch preprocessing_sample1sc.pp.normalize_total(adata)sc.pp.log1p(adata)sc.pp.highly_variable_genes(adata)Options
| Option | Description |
|---|---|
--silent / -s | Suppress local output |
--no-plots | Don’t capture matplotlib figures |
--priority P0|P1|P2 | Set notification priority |
Examples
# Silent execution (notification only)%%niki_watch --silentmodel.fit(X_train, y_train, epochs=100)
# High priority notification%%niki_watch critical_step --priority P0results = expensive_computation()
# Skip plot capture%%niki_watch --no-plotsfor i in range(100): plt.figure() plt.plot(data[i]) plt.savefig(f"plot_{i}.png") plt.close()How It Works
- Output Capture: stdout/stderr are captured while still displaying in real-time
- Figure Detection: After cell execution, NIKI detects open matplotlib figures
- Context Gathering: Cell index and notebook name are included
- Notification: Data sent to NIKI daemon via HTTP
Requirements
- NIKI daemon must be running:
niki daemon start - IPython/Jupyter must be installed
Troubleshooting
Extension not loading
# Check if extension is availableimport niki.jupyterprint(niki.jupyter.IPYTHON_AVAILABLE) # Should be TrueNo notifications received
- Check daemon is running:
niki daemon status - Check notification config:
niki doctor