hot-notebook-patching
A JupyterLab extension for hot patching notebooks that are edited externally, for example by an AI coding agent like Claude Code.
Instead of triggering a full notebook reload (which restarts the kernel and clears widget state), only the cells that actually changed are patched into the live notebook model.
https://github.com/user-attachments/assets/6e287a55-41ff-48c0-a48c-f7a56d708413
What it does
Claude Code edits notebook.ipynb on disk
↓
Extension detects the file change
↓
Only modified cells are patched
↓
Kernel keeps running · Widget state intact · Scroll position preserved
Installation
Requires JupyterLab 4.
pip install hot-notebook-patching
Then restart JupyterLab (or start it fresh) — the extension is prebuilt, no jupyter labextension build step needed.
To uninstall:
pip uninstall hot-notebook-patching
Usage
Toolbar button
Each notebook gets a ⚡ bolt button in the toolbar. Click it to toggle auto-patch mode — the extension will watch the file for changes and patch automatically.
Commands
| Action | How |
|---|---|
| Patch once from disk | Toolbar ⚡ button (when auto-patch is off) · Cmd/Ctrl+Alt+P inside a notebook · Command Palette → Patch Notebook From Disk |
| Toggle auto-patch | Toolbar ⚡ button · Command Palette → Toggle Auto-Patch on File Change |
What is preserved
- Running kernel
- Widget state (ipywidgets, anywidget, …)
- Cell outputs and execution counts
- Scroll position
What is updated
- Cell source code (with line-level diff indicators)
- Cell metadata
- Added / deleted / reordered cells
Development
# Terminal 1: rebuild on every source change
source .venv/bin/activate
jlpm watch
# Terminal 2: start JupyterLab
source .venv/bin/activate
jupyter lab
After each rebuild, hard-refresh the browser tab (Cmd+Shift+R) — no server restart needed.
Metadata
Release files for hot-notebook-patching 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| hot_notebook_patching-0.2.2.tar.gz | 133.8 kB | Without provenance | Details for hot_notebook_patching-0.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| hot_notebook_patching-0.2.2-py3-none-any.whl | Python 3 | none | any | Details for hot_notebook_patching-0.2.2-py3-none-any.whl |
Total release size: 161.9 kB
Release files / hot_notebook_patching-0.2.2.tar.gz
| Download URL | hot_notebook_patching-0.2.2.tar.gz |
|---|---|
| Size | 133.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1b932b6e870cf35613611703f64fd7de90e92cfd7d1def47b6e6b0d5eada5597
|
|
BLAKE2b-256 checksum How to use checksums |
0f7a2aec536fc1f39b4ed436fa23f8d65de7899f00d01d835f8a736e084f40e6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Release files / hot_notebook_patching-0.2.2-py3-none-any.whl
| Download URL | hot_notebook_patching-0.2.2-py3-none-any.whl |
|---|---|
| Size | 28.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
50d8238fcab21985a733ab4af8d81ab72bb18b96a5890aec732e39a948e6167b
|
|
BLAKE2b-256 checksum How to use checksums |
e8fabb22ca6db27acf74980a66dd161b5d8379150d0c81895c16993500a87544
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Security for hot-notebook-patching 0.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.