Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Enabling ipynb-free workflows in Jupyter #443

Closed
rsokl opened this issue Feb 24, 2020 · 12 comments · Fixed by #525 or #526
Closed

[Feature Request] Enabling ipynb-free workflows in Jupyter #443

rsokl opened this issue Feb 24, 2020 · 12 comments · Fixed by #525 or #526
Milestone

Comments

@rsokl
Copy link

rsokl commented Feb 24, 2020

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 ?

@mwouts
Copy link
Owner

mwouts commented Feb 24, 2020

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 mwouts added this to the 1.4.0 milestone Feb 26, 2020
@rsokl
Copy link
Author

rsokl commented Feb 27, 2020

@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.

@mwouts
Copy link
Owner

mwouts commented May 26, 2020

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).

@rsokl
Copy link
Author

rsokl commented May 26, 2020

This would be awesome!

@mwouts
Copy link
Owner

mwouts commented May 27, 2020

I have a UI working with 448fcc0:
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!

@mwouts
Copy link
Owner

mwouts commented May 28, 2020

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.

@mwouts
Copy link
Owner

mwouts commented May 28, 2020

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

@mwouts
Copy link
Owner

mwouts commented May 28, 2020

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 😄

I'll let you know when this is fixed!

@mwouts
Copy link
Owner

mwouts commented May 28, 2020

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

@mwouts
Copy link
Owner

mwouts commented Jun 1, 2020

Done at #528

@mwouts mwouts closed this as completed Jun 1, 2020
@rsokl
Copy link
Author

rsokl commented Jun 7, 2020

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

@mwouts
Copy link
Owner

mwouts commented Jun 7, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants