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.0.tar.gz (124.0 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.0-py3-none-any.whl (28.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hot_notebook_patching-0.2.0.tar.gz
  • Upload date:
  • Size: 124.0 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.0.tar.gz
Algorithm Hash digest
SHA256 1e6436eee183871971d3a13d30fc51e494697b6103f0a6c2dd816e9cf2bd0964
MD5 d10c600987d28704f3b93262989a87c7
BLAKE2b-256 952572df1be1776282f2320a18b03eb9bf008496ecf7c7e3429b3585d1876e23

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hot_notebook_patching-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fff7d716ca9049e1656bae5230af24ae9b11623a71ae93174d04068a9bed2cd6
MD5 bc8af4bd9270a18609f06035eccadd28
BLAKE2b-256 226f2aaf13b3fba986565699f1093411ba63442ac8157605c0827913635c4cd8

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