jupytext icon indicating copy to clipboard operation
jupytext copied to clipboard

Jupytext could be more selective re. which files are notebook

Open mwouts opened this issue 4 years ago • 2 comments

Currently the Jupytext contents manager classifies as a notebook every file that has a Jupytext extension. This is probably a bit too inclusive, cf. #224, #183.

It would be nice to have a function that can tell whether a file is a notebook (e.g. it has some 'jupyter' metadata in the YAML header). We have seen uses cases for this in Jupyter Book (@choldgraf ) and in Voila (@sylvaincorlay).

Once we have this function, we could change the default behavior in the contents manager and only classify as notebooks the files that do have this jupyter metadata (plus maybe percent and Sphinx scripts, and R Markdown files?)

This is also related to #271: once Jupytext is a bit more selective about which files are notebook, we could consider open all these files are notebooks by default in Jupyter Lab.

mwouts avatar Oct 12 '19 10:10 mwouts

what if it just supported anything that exists in a jupyter: YAML frontmatter. E.g. if people defined other variables, or if it was simply jupyter: true then Jupytext would assume it should parse the document as a Jupyter notebook. And if not, maybe just dump the whole markdown contents into a single markdown cell. This behavior would not happen if jupyter: false or if there was no jupyter: YAML frontmatter.

choldgraf avatar Oct 14 '19 16:10 choldgraf

@mwouts personally the main thing that attracted me to jupytext was the ability to edit a script as a notebook without having to add additional metadata.

My interpretation of #224 and #183 is that they are issues with changing the default open behavior for non .ipynb files rather than issues with which files can be opened as notebooks.

I think the current integration in jupyterlab is the ideal solution (left click opens based file extension with the option to right click --> open as notebook), though I would prefer that the icons displayed were still based on the file extension.

An alternative solution would be to leave the default click to open behavior in the classic interface but add an 'open as notebook' button to the top bar (though I'm note sure how feasible this is)

timothymillar avatar Nov 26 '19 22:11 timothymillar