Skip to main content

JupyterLab extension for hot patching externally modified notebooks

Project description

hot-notebook-patching

PyPI version PyPI - Python Version

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.

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) · Shift+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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hot_notebook_patching-0.2.1.tar.gz (130.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hot_notebook_patching-0.2.1-py3-none-any.whl (28.0 kB view details)

Uploaded Python 3

File details

Details for the file hot_notebook_patching-0.2.1.tar.gz.

File metadata

  • Download URL: hot_notebook_patching-0.2.1.tar.gz
  • Upload date:
  • Size: 130.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0

File hashes

Hashes for hot_notebook_patching-0.2.1.tar.gz
Algorithm Hash digest
SHA256 39c3487c2f6b5833669dae8624c640ca2aff60bb753f11d404e9b90d35f51eaa
MD5 a25be4fec4b91c48af54ea2b0b7893eb
BLAKE2b-256 ccc9121aa51d5378846e372951f504f805778d8cd821575a52c9288ff92465f3

See more details on using hashes here.

File details

Details for the file hot_notebook_patching-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for hot_notebook_patching-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b74f60f1bbad72543f85c2d33140adf49bca5175256c1261c06b17c503b9284b
MD5 7fbad1a5128f4bbbbb56436aed6f9390
BLAKE2b-256 7701bbaf9c83f1e3a0ec89f51393758538ee4ba9de14cffe94c5a178ff21fcc6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page