jupytext
jupytext copied to clipboard
Behavior of "File -> Download as -> ..." depends on which formats the notebook is paired with
Thank you for making Jupytext awesome.
Steps to repro:
- From the notebook web interface, create an empty Python notebook.
- Open the Python notebook, pair it to a light-script, save, and close.
- Open the
.py
file corresponding to the notebook. - Unpair the
.py
file from the "ipynb document" format, and (I don't think this is necessary) delete the.ipynb
file - Create and evaluate a code cell, e.g.
1 + 1
(and see the output2
in the browser) - File -> Download as -> HTML, and open the HTML file. Result: no cell output.
- File -> Download as -> Notebook (ipynb), and open the notebook JSON. Result: no cell output.
- Now pair the notebook with ipynb document. No need to save, just enable the pairing.
- File -> Download as -> HTML, and open the HTML file. Result: yes cell output.
- File -> Download as -> Notebook (ipynb), and open the notebook JSON. Result: yes cell output.
I would expect "Download as" to produce something equivalent to what's shown in the browser, hence to include cell outputs if the download format has a way to include them (as HTML and ipynb do). And I wouldn't expect the behavior to depend on what output formats the notebook is paired with.
Hello @bzinberg , thanks for asking.
Actually I'm not so sure of what happens exactly when you do Download as .... I've tried looking into this at https://github.com/jupyter/notebook, but I could not find out if what you get is the result of a nbconvert
command applied to the local .ipynb
file (or the .py
file in your case?). To tell the truth I am even a bit surprised that you get anything meaningful when running these commands with the .py
file opened!
Still, you're not the first one to ask. So if we could understand better what goes on when we click on Download as..., it would surely help. Also, in the past I note that we had an issue related to the document path (was .py
in early versions, even when a .ipynb
document was opened, cf. #118 ).