Skip to content
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

Generating multiple responses from multiple lines of code in a notebook code cell #11

Open
psychemedia opened this issue Oct 18, 2024 · 2 comments
Labels
feature New feature or request

Comments

@psychemedia
Copy link

psychemedia commented Oct 18, 2024

In IPython notebooks, code cell outputs display any object returned by the last line of code in the block.

In the Jupyter IRkernel, response objects are displayed from each response generating line of code:

image

In the jupyterlite-webr-kernel, we seem to follow the behaviour of the IPython kernel rather than the IRkernel:

image

As does the xeus R kernel:

image

Does the webr kernel return the multiple values, so that they could all be displayed, as per the IRkernel model, or does it just return the final value?

Actually, is the IRkernel displaying values as they are returned, rather than returning a result from the code cell? IRkernel behaviour described here: IRkernel/IRkernel#225 Seems like the IRkernel folk are maybe doing something atypical...

@georgestagg
Copy link
Member

The webR kernel returns only the final value right now. I think it would be a good feature to switch to the IRkernel style, also similar to the output when using knitr to render R Markdown.

This should be possible by setting up the webR kernel to execute code with the evaluate package. Then a single input cell could generate multiple outputs. Perhaps this should all be behind a setting, too, since as you have discovered this is not the default behaviour and probably something that IRkernel is explicitly adding themselves.

@georgestagg georgestagg added the feature New feature or request label Oct 23, 2024
@psychemedia
Copy link
Author

I think that having it as a setting would be a courteous thing to do. I am firmly in the "one output" camp, but working with someone who has only known the IRKernel approach and sees that as a more R idiomatic response.

It might even be useful to allow it as a user preference via a JupyterLab user setting, but that adds quite a lot of complexity and effort.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants