-
Notifications
You must be signed in to change notification settings - Fork 17
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
Support stdin output #233
base: main
Are you sure you want to change the base?
Support stdin output #233
Conversation
a26ab32
to
fd7d841
Compare
jupyter_ydoc/ystdin.py
Outdated
|
||
{ | ||
"state": Map[ | ||
"pending": bool, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there are no non-pending inputs, they get cleared away once the result was submitted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Though maybe there will be fore example if the kernel dies. Should we then clear the input box or keep it with some kind of disconnected icon?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By "pending" I meant that the input is in a "being edited" state or a "submitted" state, in which case it cannot be edited again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Though maybe there will be fore example if the kernel dies. Should we then clear the input box or keep it with some kind of disconnected icon?
In this case I guess we should just remove the stdin
output from the shared model, because the kernel is not actually waiting for an input anymore, right?
jupyter_ydoc/ystdin.py
Outdated
.. code-block:: json | ||
|
||
{ | ||
"state": Map[ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a question we do not need to answer now: should there be an owner of the input box too? So that the input can be provided only by the user who executed the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we think inputs are collaborative, then anybody should be able to fill them, right?
Otherwise I don't think this is really compatible with CRDTs, that are essentially shared structures.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A teacher may want students to see what they are typing, but not allow students to type in into their box.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At first sight it looks like the same issue as with cell code: there is no way to prevent a student from changing the code. Why would it be different with a input? If it's because it's the teacher who executed the cell, well this information is not present in the shared model, and I don't think it should be. And anyway, a student can re-execute the cell, and now should they be able to type in into the box? It doesn't really make sense.
A clearer model would be that the whole notebook is read-only for students. In this case we could ignore their Y-updates so that they can't change the shared model. This would make use of user permissions.
This is a general constraint of CRDTs, everybody sees the same data, unlike in a server/client architecture where a client makes a request and receives a dedicated reply. For instance, paginated results are possible with HTTP but not with CRDTs.
A frontend observing cell output changes would see the addition of an output of type |
As long as we configure it to be 1-line editor this would not be a problem. |
But |
Mmm but CRDTs are local-first, so there shouldn't be any latency for what the local user types, only for remote users, which mostly depends on the network. |
fc65622
to
90145e6
Compare
No description provided.