Replies: 2 comments 2 replies
-
The execute option in a .ipynb will change the ipynb in a number of other ways that are consistent with the Jupyter model. Specifically, we store the results of the execution in that .ipynb. It would be inconsistent (and impossible to later use This behavior is designed to mimic the workflows that Jupyter users are accustomed to, and is working as intended. |
Beta Was this translation helpful? Give feedback.
-
If I'm not mistaken, the this would nothing:
parameters would not be injected into the Maybe it would be nice to have a
I guess I could setup a pre-render step to convert the ipynb to qmd and then render just the qmd with paramaters (maybe a book type, so I can specify which files needs to be rendered). It's a little bit more overhead, but could work; needs to play with that. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
I'm playing with parameters and have noticed an somewhat inconsistent behavior when using a ipynb file instead of a qmd one.
--execute
options), the source ipynb file change, because there it is added the cell with the injected parameters.Here a simple example:
ipynb
and change the filename (so it does not get overwritten when rendering the qmd file)quarto render -P a:23 -P b:34 --execute
both document will render with the given parameter values, but:
I'm using vscode and the change in the ipynb source file could be "sneaky", meaning that if I have the file open in the editor because I'm likely working on it with some unsaved changes, then the editor will not update to the most updated file, but preserve the current view, and warns me of the version mismatch when I'm trying to save again.
If instead I have open the injected version of the ipynb, in order to restore to the previous state I would have to delete the injected code cell, then rerun the notebook.
I understand that this may be the intended behavior, but I would prefer for the source file to remain unchanged, otherwise I could have specified directly in the code cell those parameters and compute the notebook with less back and forth.
Could this maybe an option to have an intermediate file where the changes are applied for rendering? I think something similar already happen for the inline python code, that is evaluated for the output document, but the code is not changed to the evaluated value in the source file.
Why I'm doing this
I'm doing my authoring mostly with ipynb because I've lots of code cell, so using a jupyter notebook is useful for fast preview while still editing. Among these code cell, I'm generating lot of equations (sympy), but the format that is quarto friendly and let me to label the equation is not fully compatible with KaTeX, i.e. the latex engine that render equations in the jupyter notebook (really is the
\label
command that gives the most trouble). So being able to use parameters at rendering time would let me set a default parameter in my code so that equation are rendered correctly by KaTeX during editing in the notebook, and then set another value when rendering with quarto so that I can still cross-reference the equationBeta Was this translation helpful? Give feedback.
All reactions