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

Format code output like jupyter notebook #60

Open
CloseChoice opened this issue Jul 28, 2023 · 4 comments
Open

Format code output like jupyter notebook #60

CloseChoice opened this issue Jul 28, 2023 · 4 comments
Assignees

Comments

@CloseChoice
Copy link
Owner

If someone prints or outputs a dataframe it should look like in a jupyter notebook

@giggity-hub
Copy link
Collaborator

I don't think it's possible to implement that with pyodide without considerable jank.
Pyodide lets us register a javascript stdout callback function but we only get the console output as a string (line by line i think).
To be able to detect if a user printed a dataframe we would have to intercept the stdout inside the python interpreter where we can check the type.
To detect if the user printed a dataframe and then render it as html could be done with a custom pretty print handler but we would still have the issue that the stdout is given to JS line by line and not on a per object basis.
I can't think of a way to get the html representation of a dataframe from inside pyodide to the JS frontend.
Do you have any suggestions on how this could be accomplished?

@giggity-hub
Copy link
Collaborator

The Jupyter Lite project delivers a whole jupyter notebook environment into the webbrowser based on pyodide. Maybe this could be incorporated as the editor?
https://jupyterlite.readthedocs.io/en/latest/

@CloseChoice
Copy link
Owner Author

CloseChoice commented Jul 29, 2023

This looks good, I created another issue where we can check if jupyterlite is a valid solution

@giggity-hub
Copy link
Collaborator

Ooof. Doesn't actually look that good. Jupyterlite can't just be dropped in as a shell. It has to be build and served on the server. Also it looks like it's not that easy to customize e.g. to use only some parts of the ui

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

No branches or pull requests

2 participants