-
Notifications
You must be signed in to change notification settings - Fork 34
Surface the Pyodide logs to the UI #177
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
base: main
Are you sure you want to change the base?
Conversation
}; | ||
|
||
// Workaround for being able to get information about packages being loaded by Pyodide | ||
// See discussion in https://github.com/pyodide/pyodide/discussions/5512 |
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.
Wondering if there is a better way to do this? The idea would to get everything that usually gets logged by Pyodide in the dev tools console, at startup but also when loading new packages dynamically.
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.
You probably want to do this and also to set custom standard steam handles. But I assume you're already setting the stream handlers somewhere.
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.
So there are two parts here. One is logging during package loading and one is logging messages sent to Pyodide's but not Python's stdout/stderr. The latter you can override using _pyodide.setStdout
and _pyodide.setStderr
. The former is a bit trickier. Overriding loadPackage works but only if it hasn't already been imported using from pyodide_js import loadPackage
anywhere yet. Also, overriding it to always provide the custom callbacks means that users can no longer override it themselves. I still think that in the long term adding something like pyodide/pyodide#5442 to Pyodide to override the default stream for package logging would be better
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 this override does respect it if the user manually calls loadPyodide
with their own callbacks.
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.
@ryanking13 maybe we should consider merging some version of pyodide/pyodide#5442 as a stop-gap solution until a more general thing exists. Is anyone planning to work on this soon?
I'm excited to use this feature! |
} | ||
|
||
const logger = loggerRegistry.getLogger(notebook.sessionContext.path); | ||
logger.log(payload); |
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.
These logs are reported as info
, which will not make the log console status bar item flash by default since it defaults to warning
.
Some users have reported the flash to be irritating: jupyterlab/jupyterlab#11225. So we can let users choose their log level and not default to info
.
Ah, sorry, @jtpio, I didn't see that I was pinged here! I remember that @juntyr's https://github.comclimet-eu/pyodide was doing this sort of thing by calling a bunch of Edit: oh, I just went through the linked issue, and I see that Juniper has already linked it in their response in jupyterlite/jupyterlite#1498 (comment) 😄 I think the That said, I'm not an expert on the JS side for Pyodide, so perhaps Hood and Gyeongjae would know :) cc: @hoodmane @ryanking13 |
For jupyterlite/jupyterlite#1498.
Depends on jupyterlite/jupyterlite#1642.
cricital
logs if an exception is caught during the kernel initialization processlogger
function to report kernel logsjupyterlite-kernel-status-indicator.mp4
jupyterlite-kernel-critical.mp4