Collaborative Editing in Jupyter Notebooks

Hi!

Kevin Jahns

Open Source Developer​ & Freelancer

> I work to make the web more collaborative
kevin.jahns@pm.me

Yjs is a framework and ecosystem for building collaborative applications

@dmonad
@kevin_jahns

What is collaborative editing?

Desirable Properties:

Text

Past efforts

  • 2013-now: Google Colab / Colaboratory based on the Google Realtime Engine, which is now deprecated.
  • 2013-now: CoCalc by William Stein.
  • 2015-2017:  Google Realtime Integration. Brian Granger, Chris Colbert, and Ian Rose
  • 2017: Chris Colbert wrote the Lumino CRDT.
  • 2019:  Integration of the Lumino framework. Vidar Tonaas Fauske, Ian Rose, Saul Shanabrook
  • 2021:  Integrate Yjs / Shared Model. Eric Charles, Carlos Herrero, and Kevin Jahns

Jupyter Notebooks is collaborative!

 $ jupyter lab --collaborative

Problem 1: Concurrency

Insert(0, A)

Insert(0, B)

?

 

?

  •   Insert(0, A) • Insert(0, B) = BA
  •   Insert(0, B) • Insert(0, A) = AB

Solving Concurrency with Yjs

Y.Array([])

Y.Array(['B'])

Y.Array(['A'])

Insert(0, A)

Insert(0, B)

Y.Array(['A', 'B'])

  • Yjs implements a CRDT - a mathematical model to merge concurrent actions.
  • Fork and automatically merge data types.
  • Commutative updates.

Shared Notebook Model (1)

@jupyterlab/shared-models
 

An easy-to-use API to manipulate Jupyter Notebooks

Shared Notebook Model (2)

An easy-to-use API to manipulate Jupyter Notebooks

@jupyterlab/shared-models
 

Shared Notebook Model (3)

An easy-to-use API to manipulate Jupyter Notebooks

@jupyterlab/shared-models
 

Shared Notebook Model (4)

An easy-to-use API to manipulate Jupyter Notebooks

@jupyterlab/shared-models
 

Problem 2: Keeping compatibility

Non-collaborative mode

Non-collaborative mode

Collaborative mode

Y CRDT Project

  • https://github.com/yjs/y-crdt 

  • Rust Implementation of the Yjs CRDT

  • Language bindings to other languages

    • Python

    • C/C++

    • Java

    • PHP

    • WASM

    • ..

  • Write a “Shared Model” for Python.

  • Makes it possible to write a proper multi-user backend

 

Plans for 2022 / JupyterLab 4.0

  • Collaborative editing is enabled by default
  • More collaborative features:
    • Commenting
    • Chat
    • Version History

Thank you

Thank you

Sponsors

Sponsors

Made with Slides.com