jupyter-rtc-automerge

The Jupyter RTC Python module using Automerge backend.


Keywords
jupyter, realtime-collaboration
Install
pip install jupyter-rtc-automerge==0.1.1

Documentation

Real Time Collaboration

This monorepo contains current work on Real Time collaboration for use in JupyterLab and other web applications.

It is currently in the planning stage, but eventually we see it containing a number of seperate projects like:

  • js/rtc-client: Real time collaboration client in Javascript, builds on @lumino/datastore
  • py/rtc_relay: Python patch relay server to syncrhonize patches for js/rtc-client
  • js/jupyter-rtc: Holds schema for Jupyter RTC tables that are used in server and client.
  • js/jupyter-rtc-server: Server to keep datastore in sync with jupyter server.
  • js/jupyter-rtc-client: Client to access Jupyter data, uses `py/rtc_relay

Most of the work currently is living in a PR to JupyterLab and documented on an issue there.

Comparison

Our current approach is to handle all communication on the clients. Alternatively, here we propse having a server side datastore peer that handles keeping the models up to date from the Jupyter server. It expose REST API endpoints to trigger actions on the server, that are similar to the existing kernel endpoints, except instead of returning the state they update the RTC models. They also expose many of the kernel websocket methods as REST calls.

Why?

  • Keep models updated when clients are closed.
  • Reduce complexity on the clients.
  • Works with existing infrastructure, i.e. Jupyter Server; doesn't disrupt old way to interact with server (can be run side-by-side).
  • Single source of truth datastore on the server.
  • Similar REST API to existing Jupyter Server REST API — less work for clients to switch to RTC.

  • jupyterlab/jupyter-datastore API spec
    • kernelspecs
    • status
    • terminals
    • kernels
    • sessions
    • contents
    • config (Maybe we dont need this?)
    • Rewrite to clone existing API more closely
    • Add REST endpoints for execution with cell ID
    • Add a table for kernel executions (for consoles)
    • Deal with request_input, either in websockets or CRDT.
    • Spec out websockets for comms
    • Add config for refresh
  • Research alternative communication layers
  • jupyterlab/lumino-datastore API spec
    • Create API spec based on Vidar's work
  • Look into ORM on top of tables, using Ian's work
  • Think about undo/redo behavior!
  • Think about users and permissioning!

jupyterlab/lumino-datastore

Includes client and server side components for synchronized CRDTs in the browser.

jupyterlab/jupyter-datastore

The Jupyter Datastore package gives you an up to date data model of the Jupyter Server data structures in your browser. It also provides an interface to take actions on the Jupyter Server.

It is meant to be a building block for any Jupyter web UIs.

Goals:

  • Save notebook outputs even when client is closed
  • Add undo/redo
  • Sync models between browser windows

RTC models in ./spec.ts

API spec in main.py, translated to OpenAPI spec in spec.json which will be implemented in Node.

Resources:

Generating spec:

python main.py > spec.json