Skip to main content

jupyter_live_content

Github Actions Status

A JupyterLab extension that keeps open documents in sync with their file on disk. When a file changes on disk while you have it open — for example, an AI agent or another process rewrites it — this extension reloads the document in the browser so what you see stays current, without requiring real-time collaboration (RTC).

This extension is composed of a Python package named jupyter_live_content for the server extension and a NPM package named @jupyter-ai-contrib/live-content for the frontend extension.

How it works

The server extension watches the content directory for filesystem changes and notifies the browser over a WebSocket when a file you have open changes. The frontend then reloads that document from disk (context.revert()), but only for documents where a whole-file reload is safe.

Reloading is deliberately conservative. It is applied only to documents whose view is a pure function of the file's bytes, so a reload cannot destroy in-memory state. This is an allowlist: any document type not listed below is left untouched rather than reloaded.

What gets updated

Document Updated live? Notes
Text / code / Markdown in a file editor (FileEditor) Yes Reloads the text buffer. Includes a notebook opened via Open With → Editor.
Markdown preview (MarkdownViewer) Yes Re-renders from the reloaded text.
Images (ImageViewer) Yes Re-renders the image.
A document with unsaved changes (dirty) No Your edits are never clobbered; JupyterLab's save-conflict dialog resolves the divergence when you next save.
Notebooks (the notebook view) No Reverting would discard outputs, execution counts, cell IDs, and the running-kernel association. This holds even for a read-only notebook, since read-only blocks saving but not running cells.
Collaborative / RTC-backed documents (JupyterGIS, JupyterCAD, chat files, …) No The document's own provider owns synchronization.
Any other / third-party document type No Excluded by default (allowlist).

Real-time collaboration (RTC)

If an RTC provider (jupyter_server_ydoc / Jupyter Collaboration, or jupyter_server_documents) is installed and enabled, RTC already keeps open documents in sync, so this extension disables itself entirely: the server does not watch the filesystem or open a WebSocket, and the frontend does not connect. If a provider is installed but disabled (via jupyter server extension disable or the disable_rtc trait), this extension stays active.

Future work

  • Notebooks. Reliably reconciling an out-of-band notebook edit with live in-memory state (so a benign change to one cell doesn't blow away work in another) is unsolved. See the discussion in #2 and #5.
  • More viewer types. Other read-only viewers (CSV/TSV, etc.) could be added to the allowlist as their reload behavior is validated.
  • PDFs. JupyterLab 4 ships no built-in PDF document-widget viewer, so there is currently no PDF surface to update; a custom viewer would need to opt in.

Requirements

  • JupyterLab >= 4.0.0

Install

To install the extension, execute:

pip install jupyter_live_content

Uninstall

To remove the extension, execute:

pip uninstall jupyter_live_content

Troubleshoot

If you are seeing the frontend extension, but it is not working, check that the server extension is enabled:

jupyter server extension list

If the server extension is installed and enabled, but you are not seeing the frontend extension, check the frontend extension is installed:

jupyter labextension list

Contributing

If you would like to contribute to this extension, please refer to the Contributing Guide.

Metadata

Release files for jupyter-live-content 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jupyter-live-content 0.1.2
File Size Uploaded
jupyter_live_content-0.1.2.tar.gz 211.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for jupyter-live-content 0.1.2
File Interpreter ABI Platform
jupyter_live_content-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 243.4 kB

Release files / jupyter_live_content-0.1.2.tar.gz

Download URL jupyter_live_content-0.1.2.tar.gz
Size 211.9 kB
Tags Source
SHA-256 checksum
How to use checksums
8beaebc5703b431fa5f8e6236ca569a5b74533226abffe5e0f9802c997fc8586
BLAKE2b-256 checksum
How to use checksums
9b4f521b0ed7976963cbf7e9d4d9f88967ca997ec05068e11664cf7290ca1695
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.12.14

Release files / jupyter_live_content-0.1.2-py3-none-any.whl

Download URL jupyter_live_content-0.1.2-py3-none-any.whl
Size 31.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
99b99a87cb5ee04d854b2fff677fc60dee6b274bfe1e4232e6b80f0dfc2c362d
BLAKE2b-256 checksum
How to use checksums
8c48a63293d5f24fa567e8e26c76fedcf46343050800393277c582219eaa99d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.12.14

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page