jupytext
jupytext copied to clipboard
jupytext, jlab and retrolab
Hi there
as far as I know, it is now relatively easy to work with jupytext-encoded notebooks from jlab at least this works well for me, with this custom setting in place
cat ~/.jupyter/labconfig/default_setting_overrides.json
{
"@jupyterlab/docmanager-extension:plugin": {
"defaultViewers": {
"markdown": "Jupytext Notebook",
"myst": "Jupytext Notebook",
"r-markdown": "Jupytext Notebook",
"quarto": "Jupytext Notebook",
"julia": "Jupytext Notebook",
"python": "Jupytext Notebook",
"r": "Jupytext Notebook"
}
}
}
the thing is, I would now need to achieve the same behaviour but under retrolab, which for the time being seems totally stubborn in opening those files as text - even if I try to choose another opening method by right-clicking from the filebrowser...
I thought maybe it'd help to document these in the readthedocs manual, I can volunteer to do that in a PR (adding in the FAQ section for example)
@jtpio , do we expect this issue to be addressed by our PRs #933 and #934 ?
@mwouts I think so. There is a quick screencast of what it would look like in Notebook v7 in this comment: https://github.com/jupyter/notebook/pull/6315#issuecomment-1073231728
@fcollonval also mentioned updating Jupytext to default to the Notebook factory so it becomes seamless.
Ok great! So, if I understand correctly, this will become available with Notebook v7 and will be able to open text files as notebooks without having to create a default_setting_overrides.json
?
If so then I'll leave this issue open, we'll test that on our binder (and remove the default_setting_overrides.json
file there), and also update that part of the documentation:
https://github.com/mwouts/jupytext/blob/90f736849a1158e12f295f96bd287a3a6186fd21/docs/index.md?plain=1#L33-L48
I'd like, in addition, to add a link to retrolab on our Binder. I see that this is possible, cf your gist, well done Jeremy :+1:
I am struggling to install the development version of jupyterlab
, retrolab
and notebook
. With this in my Binder requirements:
https://github.com/mwouts/jupytext/blob/a5edb8151a660c9bdff71da47ab3518769e32c65/binder/requirements.txt#L1-L3
I get this error:
The conflict is caused by:
jupyterlab 4.0.0a20 depends on jupyter-server~=1.4
notebook 7.0.0a1 depends on jupyter-server~=1.4
retrolab 0.4.0a1 depends on jupyter-server~=1.4
jupyterlab-server 2.11.2 depends on jupyter-server~=1.8
jupyterlab 4.0.0a20 depends on jupyter-server~=1.4
notebook 7.0.0a1 depends on jupyter-server~=1.4
retrolab 0.4.0a1 depends on jupyter-server~=1.4
jupyterlab-server 2.11.1 depends on jupyter-server~=1.8
jupyterlab 4.0.0a20 depends on jupyter-server~=1.4
notebook 7.0.0a1 depends on jupyter-server~=1.4
retrolab 0.4.0a1 depends on jupyter-server~=1.4
jupyterlab-server 2.11.0 depends on jupyter-server~=1.8
@parmentelat or @jtpio , do you have any idea of how I can fix this? Thanks
@mwouts since Notebook v7 is now the continuation of RetroLab, the following two dependencies should be enough:
jupyterlab>=4.0.0a20
notebook>=7.0.0a1
Development of RetroLab is now happening in the Jupyter Notebook repo (main
branch): https://github.com/jupyter/notebook/
FYI a new pre-release of Notebook v7 is out: https://github.com/jupyter/notebook/releases/tag/v7.0.0a2
Which includes the factory improvement relevant to Jupytext: https://github.com/jupyter/notebook/pull/6315
Oh I see, thank you @jtpio .
I have updated the branch retrolab_on_binder
in this commit: https://github.com/mwouts/jupytext/commit/4f3e3ec39bc9c97135dcfc0582a842f2a40846fe and now I can see "retrolab / notebook" in action at https://mybinder.org/v2/gh/mwouts/jupytext/retrolab_on_binder?filepath=demo
When I right click and select "open with Jupytext Notebook", then I do get the expected notebook view.
However, I think this is less expected:
- when I double click on a text notebook, then it opens with the default text editor rather than with the Notebook editor (not expected since I have the
default_setting_overrides.json
on Binder) - when I right click and "open with Notebook", an error 424 occurs
thank you @mwouts for putting the binder together what I'm seeing right now on this binder is:
- ipynb
- double-clicking,
- or doing Open with → Notebook both work fine with the .ipynb - obviously
- md
- double-clicking on the .md opens a text editor
- Open with → Notebook on the .md file gives me a 404 - see below
not sure what's exactly in this binder though; I'm going to try and use this locally when I have a chance
![image](https://user-images.githubusercontent.com/4519227/160235841-cc25813d-34e9-45b6-baea-4cb8781041fb.png)
just to be clear, can anyone please summarise again what url should be used to open a .md or .py notebook as a notebook ? i.e. what should be the replacement for CLASSIC_NOTEBOOK_URL_FORMAT = "notebooks/{notebook}"
So far within early retrolab experiments I'd been using something like RETRO_NOTEBOOK_URL_FORMAT = "retro/edit/{notebook}"
but knowing that retrolab has gone out of the picture IIUC (as far as pip at least), did that impact the URL schemes as well or not ?
sorry for the dumb question but I guess I've read too much on that, I got a little confused and could use an update...
in any case, thanks again @jtpio and @mwouts and @fcollonval !
here's my today's experiment
conda create -n nb7 python-3.9
conda activate nb7
pip install "notebook>=7.0.0a1" "jupyterlab>=4.0.0a20" jupytext
jupyter lab
I have a py:percent jupytext-encoded notebook in slides/foo.py
from there I try to open miscell urls:
-
/lab
gives me the usual file browser -
/tree
gives me a standalone jlab-like file browser -
/edit/slides/foo.py
opens as an editor on the python file this is also what I get if from any of the 2 file browsers (/lab or /tree) I double click, or Open with → Editor -
/edit/slides/foo.py?factory=Jupytext%20Notebook
is the URL that I get if I Open With → Jupytext Notebook however this gives me a file load error that readsUnreadable Notebook: /my-absolute-path/slides/foo.py NotJSONError("Notebook does not appear to be JSON: '# -*- coding: utf-8 -*-\\n# ---\\n# jupyt...")
I thought it wasn't the expected behaviour at this point, but is it ? or am I missing some additional configuration here ?
Also, I am never quite clear about whether/how much my global jupyter* config interferes within a conda env, so there's that...
for the record
$ pip show notebook
Name: notebook
Version: 7.0.0a2
$ pip show jupyterlab
Name: jupyterlab
Version: 4.0.0a22
imho this could be closed, although I have not tried retrolab for quite a while (is retrolab still a thing ?)
I've had a quick look at this issue. As Jeremy mentioned above,
Notebook v7 is now the continuation of RetroLab
so you're correct we can close this issue since we know that Jupytext works well with Notebook v7.