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

Best practice to implement "notebook like" interface #299

Closed
marcell7 opened this issue Dec 15, 2023 · 3 comments
Closed

Best practice to implement "notebook like" interface #299

marcell7 opened this issue Dec 15, 2023 · 3 comments
Assignees
Labels
question Further information is requested

Comments

@marcell7
Copy link

marcell7 commented Dec 15, 2023

Is there a straight forward way to implement notebook like interface using this library (like jupyterlite / jupyterlab)? I I have been experimenting with usePythonConsole and I've found that it might work quite well.
I'm asking this mainly because the whole Pyodide ecosystem is new and there is not much info out there, especially regarding notebook interfaces which should now be relatively easy to implement with libraries like this one.
Thanks for any suggestions and keep up the good work.

@elilambnz elilambnz self-assigned this Dec 15, 2023
@elilambnz elilambnz added the question Further information is requested label Dec 15, 2023
@elilambnz
Copy link
Owner

A basic notebook interface should be quite straightforward as you only need to worry about UI/UX, however replicating all of the features from Jupyter notebooks would require a lot of work.

The usePythonConsole hook is probably the best way to achieve this. You would need to reuse a single Python instance to retain variables.

One major feature of Jupyter is that they seem to have detection for popular data visualisation libraries, such as matplotlib plt.show() which isn't trivial to do and you would probably require custom handling for each library.

@marcell7
Copy link
Author

Ideally I just need the option to retain variables and pass some data from js to python. From what I've read, Pyodide supports this

@elilambnz
Copy link
Owner

Reusing the same Python instance will retain variables, as it spawns a web worker which stays active until you terminate it or a user refreshes the page.

Support for accessing the Python scope is being tracked here #67 and is not yet implemented in react-py. This would allow for direct getting/setting data in Python from the JS side. There are methods in Pyodide which make this possible, but interacting with web workers adds a lot of complexity.

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

No branches or pull requests

2 participants