-
Notifications
You must be signed in to change notification settings - Fork 57
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
Stream output problem when publishing with jupyter-book
#393
Comments
Python must do something special when it hooks into Jupyter Book. As mentioned in the specific comment you linked to, 99% of the time you don't want to coalesce into a single output block.
That's a feature, not a bug, of stata_kernel, because you don't want to wait for the entire Stata block to finish before you get output. I don't see any way to fix this without a significant overhaul to optionally not return a stream. |
Totally agree. The only time you want the non-stream output is with certain automated publishing pipelines like jupyter-book, although in my particular use case the models I am running are computationally trivial so any hangs are not noticeable. Taking a second look at emacs org mode and how it handles stata output with sysuse auto
sum
sleep 10000
reg price mpg and no results are returned until the completion of all code in the block and both sets of results are included in the block. So this seems to be more of a client-side issue where clients can "clean up" the stream if need be, as emacs does by constructing an example block of results. |
I can't remember if the jupyter protocol ends a stream response with a custom message. If so, seems easy to collect a stream into a single block (as long as you assume a continuous stream is intended to go into a single block). Otherwise seems impossible to know how long to wait on the stream. |
I played around a bit more and noticed that in Emacs, the |
There is a jupyter-book issue that is causing problems with jupyter-book publishing when using
stata_kernel
. Basically, streaming output for a command is split byjupyter-book
into multiple output cells per code block, which isn't pretty, as seen in the screenshot of the compiled document:According to this response, it is a matter of switching from stream output to coalescing into
text/plain
output.As a side note, Stata 17 with the
%%stata
magic has similar issues but the undocumentedconfig.set_streaming_output_mode('off')
fixes it so it behaves like Python. This does cause output to appear to hang as no intermediate output is printed as the command runs. Rather it is collected until the command is finished. This fixes the problem seen in the picture above.The text was updated successfully, but these errors were encountered: