jupyter notebook use issue

74 views
Skip to first unread message

HaveF HaveF

unread,
Nov 26, 2023, 8:51:53 PM11/26/23
to leo-editor
Hello,

Has anyone told me how you are currently using jupyter notebooks in Leo? Jupyter notebooks are usually long(example: https://github.com/pycaret/pycaret/blob/master/tutorials/Tutorial%20-%20Regression.ipynb), but they are sometimes segmented by md file's header tags, which feels like a good use case for Leo. But I found that both @auto or @clean just imported the notebook into a long JSON file. Am I doing something wrong?

Thank you

BR,

Edward K. Ream

unread,
Nov 26, 2023, 9:43:24 PM11/26/23
to leo-e...@googlegroups.com
On Sun, Nov 26, 2023 at 7:51 PM HaveF HaveF <iamap...@gmail.com> wrote:
Hello,

Has anyone told me how you are currently using jupyter notebooks in Leo? Jupyter notebooks are usually long(example: https://github.com/pycaret/pycaret/blob/master/tutorials/Tutorial%20-%20Regression.ipynb), but they are sometimes segmented by md file's header tags, which feels like a good use case for Leo. But I found that both @auto or @clean just imported the notebook into a long JSON file. Am I doing something wrong?

You haven't done anything wrong. Leo doesn't support Jupyter notebooks directly.

You might try using leoInteg in vscode. vscode probably has pretty good support for Jupyter notebooks.

Edward

HaveF HaveF

unread,
Nov 26, 2023, 9:49:39 PM11/26/23
to leo-e...@googlegroups.com
You might try using leoInteg in vscode. vscode probably has pretty good support for Jupyter notebooks.
 
Thanks for your advice, Edward

Edward K. Ream

unread,
Nov 26, 2023, 9:54:44 PM11/26/23
to leo-e...@googlegroups.com
On Sun, Nov 26, 2023 at 8:49 PM HaveF HaveF wrote:
You might try using leoInteg in vscode. vscode probably has pretty good support for Jupyter notebooks.
 
Thanks for your advice, Edward

You're welcome. Please let us know how you fare.

Edward

Thomas Passin

unread,
Nov 26, 2023, 10:06:45 PM11/26/23
to leo-editor
There used to be some support for Jupyter notebooks, but over time it became clear that it didn't work well.  You could read them but not interact or modify them effectively.  Since you can read them better in a browser, the support was removed.

HaveF HaveF

unread,
Nov 26, 2023, 10:21:52 PM11/26/23
to leo-e...@googlegroups.com
There used to be some support for Jupyter notebooks, but over time it became clear that it didn't work well.  You could read them but not interact or modify them effectively.  Since you can read them better in a browser, the support was removed.
 
I see, Thomas. Reading the notebook is fine. But it lacks the clone function of leo. Since there is always some code that is generic for some typical analysis (but I don't have it abstracted into functions), I wondered if I could use Leo's clone feature to extract out the code separately so that the content of the code paragraphs could be synchronized after each change. At the moment, it seems that there is no way to solve this problem, and perhaps the practical way is to abstract this content into functions to manage it.

HaveF HaveF

unread,
Nov 27, 2023, 2:52:53 AM11/27/23
to leo-editor
Ok, it seems jupytext is the right choice. It can pair notebook with python file. I just use Leo to handle the python files :-D Great!

Edward K. Ream

unread,
Nov 27, 2023, 4:53:12 AM11/27/23
to leo-e...@googlegroups.com
On Mon, Nov 27, 2023 at 1:52 AM HaveF HaveF <iamap...@gmail.com> wrote:
Ok, it seems jupytext is the right choice. It can pair notebook with python file. I just use Leo to handle the python files :-D Great!

Thanks for the heads up.

Edward

Thomas Passin

unread,
Nov 27, 2023, 8:00:34 AM11/27/23
to leo-editor
Very sweet, and ideally suited to work with Leo.  

Thomas Passin

unread,
Nov 27, 2023, 9:16:04 AM11/27/23
to leo-editor
It occurs to me that it should be fairly easy to create a Leo plugin that would display an .ipynb file.  Both VR and VR3 used to do this.  They used a pip-installable module that converted it to HTML and displayed that, IIRC.  We could resurrect that code into the new plugin.  The plugin would let you view the .ipynb file in another pane while you had its Jupytext paired file open as a regular Python file in Leo.  I'd probably want to add a new directive to specify the paired file.

If this works out, it could be a really nice addition to Leo, at least for Jupyter files that use only Python.

HaveF HaveF

unread,
Nov 27, 2023, 9:55:02 AM11/27/23
to leo-e...@googlegroups.com
It occurs to me that it should be fairly easy to create a Leo plugin that would display an .ipynb file.  


I'm not sure if this one is of much use, don't get me wrong, Thomas, I just want you to maintain a little less code.


For me, the common way to use a notebook is mainly to change the code, run, and then view the result, for simple viewing, there are many ways, like opening it with vscode.

To be honest, for data science people, I can tolerate a shorter notebook, and I really don't know how they can put up with a notebook that is too long. 

Reply all
Reply to author
Forward
0 new messages