-
Notifications
You must be signed in to change notification settings - Fork 166
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
fix: pyodide interrupts #921
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@@ -321,9 +315,9 @@ def launch_pyodide_kernel( | |||
) | |||
|
|||
if is_edit_mode: | |||
from marimo._output.formatters.formatters import register_formatters | |||
|
|||
register_formatters() |
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.
was this just not needed before?
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'm going to add this back, for both edit/run mode
@@ -18,7 +18,7 @@ import type { | |||
export interface RawBridge { | |||
put_control_request(operation: object): Promise<string>; | |||
put_input(input: string): Promise<string>; | |||
interrupt(): Promise<string>; | |||
interrupt(buffer: Uint8Array): Promise<string>; |
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.
can we remove this?
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.
oops yes
This change gets interrupts working in WASM notebooks. The implementation uses
SharedArrayBuffer
, as recommended by Pyodide, which only works in secure contexts.An example where interrupts now work:
For some reason,
time.sleep()
cannot be interrupted -- this tripped me up for a while, because I thought my interruption implementation was incorrect.