jupytext
jupytext copied to clipboard
Using real time collaboration with Jupytext
When using Jupytext with Jupyterlab 4 and the real time collaboration feature and using a notebook in the %-format, e.g. test.py
the collaboration does not work straight away.
The issue is that when creating the link to share the notebook, for example "localhost:8888/lab/.../RTC%3A.../test.py" the second jupyter lab browser instance thinks this is a pure .py file and opens the plain text editor. And collaboration between the notebook editor and the plain text editor is not supported (https://github.com/jupyterlab/jupyter-collaboration/issues/189).
As a workaround one can always make sure only create links to the .ipynb file. Is there a possibility that this works with notebooks as %-formatted .py files as well?
out of curiosity could you please try to run this in a terminal
jupytext-config set-default-viewer
before trying again (not quite sure what exactly needs to be restarted, so please be on a safe side and restart the jupyter lab session entirely)
Thanks @parmentelat for the comment. I tried the command, reset the workspace, restarted jupyter lab and that worked out nicely! So this part of the the issue looks solved.
What turns out now is even more severe though...
To reproduce on Jupyter lab 4.0.6 with jupytext 1.15.2 and collaborative extension 1.2.0 data loss occurs with the following steps here:
- Create a test notebook with the content
print('test')
- Pair this with jupytext to a corresponding percent-file.
- Close and shutdown the kernel.
- Open the
.py
file and execute the first cell. - Close and shutdown the kernel.
- Open the original
.ipynb
.
The file content is now looks corrupted:
The file content on disk looks OK though.
hi @asteppke
- I am a little confused, to clarify, you wrote twice the words 'the file content', in both instances you are referring to the ipynb, not the py file, right ?
- my understanding is that at this stage the issue no longer relates to rtc (real time collab), can you please confirm that ?
- in other words, does it still happen if you turn off the collaboration extension ?
- finally if the issue vanishes when you turn off the collaboration extension, I would tend to think the issue belongs in that extension and not in jupytext, does that make sense ?
Hi @parmentelat,
Sorry if I did not explain this well enough. With file content I mean indeed the .ipynb
file, at least as it is shown in the Jupyter lab interface (see screenshot). The on-disk content looks at first glance OK.
Without the collaboration extension this bug does not occur. It requires both, jupytext and the collaboration extension to happen. So it is most likely an interaction of both extensions, I cannot judge in which code part the responsibility for this lies.
I'm seeing the exact same bug as described in https://github.com/mwouts/jupytext/issues/1124#issuecomment-1723280296 (paired with the "light" script). The jupytext
and jupyter-collaboration
appear to be mutually incompatible.
I've opened https://github.com/jupyterlab/jupyter-collaboration/issues/214
Thank you @asteppke for reporting this, and @goerz for the confirmation and cross report. I have not had a chance yet to give a try to the collaboration extension, but I will at least subscribe to the corresponding issue report.
The issue is still there with the newest jupyter-collaboration 2.0 release: https://github.com/jupyterlab/jupyter-collaboration/issues/214#issuecomment-1858353452