jupyterlab / jupyter-collaboration

A Jupyter Server Extension Providing Support for Y Documents
https://jupyterlab-realtime-collaboration.readthedocs.io/en/latest/
Other
166 stars 31 forks source link

Collaboration not working inside file but works in terminal. #253

Closed vanyle closed 8 months ago

vanyle commented 8 months ago

Description

While I can see cursors and selections of other people, the file is not saved automatically and I cannot see what other users are typing. I does not work for notebooks or plain text files. When using a terminal however, collaboration works properly.

image

Reproduce

I'm using the following docker-compose.yml file:

services:
  jupyter:
    image:  jupyter/pyspark-notebook:latest
    restart: unless-stopped
    ports:
      - "8888:8888"
    user: root
    working_dir: /home/vanyle
    environment:
      - NB_USER=vanyle
      - CHOWN_HOME=yes
    command: "start-notebook.py --ServerApp.token='' --ServerApp.password=''"
    volumes:
      - ./models:/home/vanyle/work

When the docker is started, I manually install jupyter_collaboration and I restart the docker.

Expected behavior

I would expect jupyter-collaboration to work. When a character is typed on one device, it appears on the other.

Context

I have the following plugins installed:

image

welcome[bot] commented 8 months ago

Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively. welcome You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! :wave:
Welcome to the Jupyter community! :tada:

davidbrochart commented 8 months ago

What do you mean by "works in terminal"?

davidbrochart commented 8 months ago

I'm facing the issue, it seems to be caused by pycrdt v0.8.13. Could you pip install "pycrdt<0.8.13" and see if it solves your issue? I'll investigate what is wrong in pycrdt.

davidbrochart commented 8 months ago

I yanked pycrdt v0.8.13 on PyPI, marked it as broken on conda-forge, and released v0.8.15 with a fix.

vanyle commented 8 months ago

It works! Thank you! I spend like 2 hours tweaking the configuration of my docker (as I'm using a custom docker with a lot of extensions) and nothing was working.

Just out of curiosity, what was the issue with pycrdt ?

davidbrochart commented 8 months ago

In pycrdt v0.8.13 the Rust backend Yrs was updated to v0.18, which changed the way observer subscriptions are handled. Now instead of getting a subscription ID, a subscription object is returned, and unobserving is done by dropping the object, so in Python a reference to the subscription has to be kept, otherwise it gets garbage-collected and it is dropped on the Rust side (see https://github.com/y-crdt/y-crdt/issues/398). I had done that for shared types in https://github.com/jupyter-server/pycrdt/pull/85 but I forgot to do it for docs, and that's now fixed in https://github.com/jupyter-server/pycrdt/pull/87. Basically all this means is that the changes to a document in JupterLab was not propagated to other users.