mwouts / jupytext

Jupyter Notebooks as Markdown Documents, Julia, Python or R scripts
https://jupytext.readthedocs.io
MIT License
6.65k stars 386 forks source link

jupyterlab how to create a new text notebook #1095

Closed parmentelat closed 1 year ago

parmentelat commented 1 year ago

in nbclassic we used to have a menu for creating a new text notebook image

I can't seem to find the equivalent under jlab was it dropped on purpose or is it just lack of time, i.e. value/devel time ratio deemed too poor ?

it would be very helpful for students, as we're trying to have them use git for everything, and ipynb under git really does not cut it :)

mwouts commented 1 year ago

Hey @parmentelat , yea it's just lack of time / typescript skills. I agree that the "New text notebook" entry was useful. Also I find that accessing the pairing commands through a menu was a bit more user friendly, but I never found the time to map the commands in the menu, although I believe that this should be possible.

parmentelat commented 1 year ago

would you agree that as a first step, a palette-accessible command to create a new text notebook would make sense ? or more likely one command per format, I guess ?

mwouts commented 1 year ago

Hey @parmentelat , yes indeed!

I think it would be useful to have a commands to create at least notebooks in these formats:

FYI in the notebook extension the menu commands were added here: https://github.com/mwouts/jupytext/blob/main/jupytext/nbextension/index.js#L376-L383

parmentelat commented 1 year ago

hi @mwouts

I still think this is a helpful feature, but I had to put this on the backburner

However maybe we can start discussing how the feature could look like in my opinion the most natural point where to add this would be here, which conveniently is valid for both lab and nb7 (even in the tree view btw)

image

(and at this location we could find a submenu with one entry per text format, like New Py:percent, etc..)

one difference with nb classic though, is that here and esp. in the context of lab, there is no 'current notebook' so the path where the new notebook is created might raise new questions; the simple approach could be to always create it at the server root, and let people move that about using the file explorer; otherwise the feature may need some sort of directory browser.. but I'm not there yet - and far from it ;)

anyways, I have taken a look at the nbextension code that you pointed at; it looks like the crux of it is actually the new_text_notebook function https://github.com/mwouts/jupytext/blob/main/jupytext/nbextension/index.js#L237-L267 but so far I fail to see how that actually works, plus I suspect many changes are going to be needed for jlab.

fyi I'm entering a rather low period for the next few weeks, so as far as I am concerned it's probably not going to happen anytime soon ;-)

mwouts commented 1 year ago

Hey @parmentelat , thank you for discussing this! Yes sure not problem at all, this would be useful indeed but there is no hurry, it will happen when we can make it happen.

Yes it would be great to have one or two entries there (maybe just for MyST Markdown and py:percent?).

Personally I mostly use the 'launcher' to create a new notebook, so maybe there we could have two entries 'New percent notebook' and 'New MyST Markdown notebook', with the list of available kernels below? launcher

In the case of the percent notebook, the extension would be chosen depending on the kernel indicated by the selected icon in the launcher.

mahendrapaipuri commented 1 year ago

I am moving this discussion here for better trackability.

@parmentelat Did you have any time to work on it? I think this would be a valuable feature for jupytext. I can see multiple points where we can add jupytext commands:

lab-toolbar

As you can see there is a lot of space there and we can add all the pairing commands there for better UX.

I can work on these features, maybe implementing them separately for better discussion and review. What do you think?

parmentelat commented 1 year ago

Hi @mahendrapaipuri

thank you so much for raising this again; actually I have not had time to address this at all, so please feel free to go ahead !

as far as I am concerned, I have no preference between all the methods proposed going from the current situation (no simple way to create a text notebook) to a situation where we would have one - any, really - way to do it simply, would have immense value in the classroom where newbie students are currently at a loss to do this :)

mahendrapaipuri commented 1 year ago

Ok, I will try it out and keep you posted.