Skip to content

Drop modelDB and use Yjs directly #253

Open
@davidbrochart

Description

@davidbrochart

Problem

JupyterLab has an abstraction layer called modelDB in the observables package, which currently serves as a proxy for the Yjs shared types. At the time real-time collaboration was being implemented in JupyterLab using Yjs, there was the question of whether to drop modelDB or keep it as an abstraction layer on top of Yjs, and it was decided to keep it so that another CRDT backend could be used, if needed. There are a number of issues with that:

  • Yjs has features that modelDB doesn't have, which therefore cannot be used, for instance:
    • deep observability,
    • transaction support.
  • since data lives in both models, memory is duplicated.
  • since there is a double binding between modelDB and Yjs, special care must be taken in order to avoid circular dependencies.

All of this results in additional complexity, for really no benefit because JupyterLab already depends on jupyter-ydoc which depends on Yjs, so JupyterLab is not CRDT-agnostic (although I agree the CRDT-specific part is well contained in jupyter-ydoc).
Additionally, as Jupyter is moving towards server-side execution, new issues start to appear because the modelDB abstraction doesn't exist in the backend, where we directly use pycrdt (Python bindings to Yrs, the Rust port of Yjs). Therefore we cannot communicate at the modelDB level between the backend and the frontend.
Finally, the possibility of using another CRDT library in the future is getting smaller as Yjs is getting more and more popular. The only real alternative is Automerge that a team of JupyterLab developers evaluated and which was eventually discarded.

Proposed Solution

I propose to drop modelDB altogether from the JupyterLab code base, and directly use Yjs instead.
See jupyterlab/jupyterlab#16481 for more discussions.

@jupyterlab/jupyterlab-council Let's vote:

EDIT: I added @RRosio, @SylvainCorlay and @Zsailer to the list of voters, according to this list.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions