Jupytext: [Feature Request] Enabling ipynb-free workflows in Jupyter

Created on 24 Feb 2020  路  12Comments  路  Source: mwouts/jupytext

The jupytext-markdown format is absolutely fantastic and jupytext's ability to open them as notebooks so nice that I basically never want to work with .ipynb files ever. Unfortunately, the process of going about a no-ipynb workflow is currently not a very convenient one.

This is my current workflow for creating a new markdown-notebook:

  1. (in Jupyter GUI) File > New Notebook
  2. (In new ipynb) Jupytext > Pair Notebook with Markdown
  3. (In new ipynb) Type something in notebook & save to force creating of paired markdown file
  4. (In markdown-notebook) Jupytext > uncheck pair notebook with ipynb document
  5. (In Jupyter GUI) Delete ipynb file

Perhaps there is a more convenient workflow that is already available, which I am not privy to. As you can see, the current process for creating a standalone markdown notebook is a bit cumbersome (and is especially frustrating if I forget to unpair the ipynb notebook).

It seems like it would be ideal to enable the user to create a [not-ipynb]-notebook directly through the Jupyter GUI, and that the notebook would not be paired to an ipynb file by default. What are your thoughts on this @mwouts ?

Most helpful comment

@mwouts thanks so much for taking the time to do this. This feature, and all of the 1.5.0 features are terrific! 馃槃

All 12 comments

Thanks @rsokl , sure that's a great idea!

Maybe the shortest way for now is to create a text file, save it with a .md extension, open it as a notebook and check 'Include metadata' in the Jupytext menu (otherwise the .md file will miss the YAML header).

Note that this was already suggested by @psychemedia a while ago at #265, but unfortunately the GUI are a bit harder to develop than the python part, at least for me.

Tell me, do you use Jupyter Notebook, or Jupyter Lab? For the former we would have to modify jupytext/nbextension/index.js, and for the latter I was told by that we could seek inspiration in the CreateNew function from JupyterLab's Typescript codebase.

@mwouts ah the text file approach is a better workaround. I use Jupyter Notebook. I have played a little with JupyterLab but get annoyed by the bugs that I have hit and the changes to the plotting backend.

I wish I had experience with GUI work, or else I'd throw my hat in the ring to help with this!

Another option could be to permit a global configuration option in jupytext such that all notebooks, by default, are created as markdown files. This may be a bit aggressive/heavy-handed, but it would at least alleviate the GUI aspect of things.

Just a quick note on this:

I'll see if I can add a new 'New Text Notebook' submenu under 'New Notebook', to allow the creation of a new text file (Markdown or script).

This would be awesome!

I have a UI working with https://github.com/mwouts/jupytext/commit/448fcc097e330c5256f1cf6dc7c4e4306dffaf30:
Screenshot from 2020-05-28 00-33-41

but unfortunately... it still creates an .ipynb file!

Maybe @jasongrout will know how to get this working.

Jason, I am trying to use the "ext" parameter in Contents.prototype.new_untitled from https://github.com/jupyter/notebook/blob/6e9256b0641a85baf664e846515085bac2c082a3/notebook/static/services/contents.js#L106-L129

From what I see, the parameter is there:
Screenshot from 2020-05-28 00-32-27

but it seems to have no effect on the function, which always returns a new .ipynb file. Do you know where the creation of the new notebook actually occurs? Thanks!

Haha I found the reason: it is because of ext = ".ipynb" in notebook.services.contents.manager.ContentsManager.new_untitled.

With ext = ext or '.ipynb' instead it works better, and a new Untitled.md file is created.
One way to solve this is to override this function in Jupytext's contents manager.

@rsokl , I have packaged this in the new RC. Would you like to give a try to pip install jupytext==1.5.0rc2 ?

Wait a minute, there are a few issues...

  • the extension is not activated automatically
  • and one cannot create a new .ipynb notebook in the tree view any more :smile:

I'll let you know when this is fixed!

pip install jupytext==1.5.0rc4 will work better.

I may still

  • revert the renaming of jupytext/index.js to jupytext/jupytext.js (that makes the dev of the extension slightly simpler, but may cause issues like duplicated Jupytext menus, etc, if the previous version is not properly uninstalled)
  • and, if possible, offer more than one declination of the script format (light/percent/nomarker), and maybe also for the Markdown format

Done at #528

@mwouts thanks so much for taking the time to do this. This feature, and all of the 1.5.0 features are terrific! 馃槃

You're welcome @rsokl! Well I am having a great time doing this :joy: . And by the way, it is very interesting for me to do this openly, with all this feedback.... People have great ideas or advice!

Was this page helpful?
0 / 5 - 0 ratings