-
Notifications
You must be signed in to change notification settings - Fork 663
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
Coalesce multiple stdout/stderr Notebook outputs into single blocks #973
Comments
Thanks for opening your first issue here! Engagement like this is essential for open source projects! 🤗 |
This is the expected behaviour of Jupyter notebook execution; that stdout streams are output in (non-determistic) chunks. The amount of chunks just depends on your transcient processing power I guess. It would be better if you could find a way to output the content as a That being said, we could look into adding an option in myst-nb to "coalesce streams", i.e. exactly what I do in pytest-notebook: https://github.com/chrisjsewell/pytest-notebook/blob/40381be0963a8866d1a46994595844bbfb4e66c1/pytest_notebook/post_processors.py#L80 |
Thank you very much Chris for your reply. I am new to notebooks, your advices are precious. It would be great if you could look into adding an option that can solve this issue. That would be really helpful. If I may, what I do not understand is why sometimes stout streams are rendered as just one block and sometimes (in a seemingly random way) as more blocks. Is that due to the Stata kernel? or may this happen also with python or other kernels? What do you mean for find a way to output the content as a plain/text output rather than a stream. Is that a kernel related behaviour? |
Yes it can happen for any kernel. With stdout/stderr streams, Jupyter dumps the output periodically, e.g. if you had: print(1)
sleep(10)
print(2) Then you want don't want to have to wait 10 seconds to see The output you are creating is essentially doing: print(" Source | SS df MS Number of obs = 74\n")
print("-------------+---------------------------------- F(1, 72) = 20.26\n")
... and it just depends how fast each line reaches the client (which is non-deterministic) vs the time interval between stream dumps. Ideally for non-interactive outputs you want to "package up" all the text and send it at the same time, which is what I mean by a from IPython.display import display
display(
" Source | SS df MS Number of obs = 74\n"
"-------------+---------------------------------- F(1, 72) = 20.26\n"
...
) But I don't know personally how you do that with stata I'm afraid. |
Got it, thanks. I'll look into the Stata kernel to see if I can package up all the output text from a single code cell and send it out at the same time as you suggest. In any case, if this may happen with any kernel, then I think that an option to coalesce multiple stdout/stderr notebook outputs into single blocks would be really useful. |
For those who have the same issue, a "temporary" workaround is to execute the notebooks on your own, copy and paste all the
Hope this helps. |
FYI. In case anyone here is encountering similar issues with Stata 17's built in
That condenses all output into a single codeblock. Still doesn't solve the problem seen in |
Hi! I'm expressing interest for this issue here (sorry for the noise). I'm coming from there: executablebooks/sphinx-book-theme#281 Is there any chance this issue will be fixed in the foreseeable future? I am well aware that this is a volunteer-led project: I'm asking now in order to decide whether or not we want to implement the workaround mentioned above in our workflow or wait for a fix. Thanks! |
This is now available in executablebooks/MyST-NB@v0.13.0...v0.13.1 (as |
I am struggling to understand why the cells output is split in multiple lines when the book is rendered using HTML. My stata.ipynb notebook source code looks like
After I built the book using
the notebook source code in the
mybook/_build/jupyter_execute
appears to be different and, as you can see below, the output of each "code" cell is split in separate linesThis is how the HTML final output looks like
Do you have any idea of why this is happening?
Many thanks!
Federico
Environment
The text was updated successfully, but these errors were encountered: