Closed kolibril13 closed 1 year ago
This is not related to ipyreact per se. I think the idea is to build jupyter lite yourself from an environment that has ipyreact installed, so that it bundles the jupyter-ipyreact jupyterlab extension with it.
I just created
https://github.com/Octoframes/ipyreact-jupyterlite
with the jupyterlite page here:
https://octoframes.github.io/ipyreact-jupyterlite/
My first attempt was to to put ipyreact into .jupyterlite/requirements.txt
,
https://github.com/Octoframes/ipyreact-jupyterlite/blob/main/.jupyterlite/requirements.txt#L5
and then installing it via pip on github actions https://github.com/Octoframes/ipyreact-jupyterlite/blob/61ee1a0ded0637054df72a8c68e09e8e353f3393/.github/workflows/JupyterLite.yml#L21 that was not causing any errors in the actions, but running a cell in JupyterLite now tells me: ModuleNotFoundError: No module named 'ipyreact'
see https://jupyterlite.readthedocs.io/en/latest/howto/configure/simple_extensions.html
Ok, I've just read this till the end and found the section:
and therefore added
%pip install ipyreact
Indeed, I don't get any error anymore, but instead the message Loading widget...
, that never transforms into a widget.
Also, when I run the cell, I get the following log error:
%%react
import * as React from "react";
export default function MyButton() {
return ( < button > X < /button>);
}
in your requirements you have ipywidgets>=7.7,<8
but you will end in with the ipywidgets 8 package. This is triggering the error: https://jupyterlite.readthedocs.io/en/latest/howto/configure/simple_extensions.html#avoid-the-drift-of-versions-between-the-frontend-extension-and-the-python-package
If you unpin it, you will get 8, which should be fine.
Ohhh, that's perfect, thank you so much! your answers are way better than from any GPT model :)
It works now fine! 🎉 🎉 🎉
Should we add a JupyterLite build for this main repo as well?
Awesome 😍 We have it for https://github.com/widgetti/reacton, but it's slightly different since that uses conda-forge, which I don't feel like adding right now. But that would be great to have!
Should we add a JupyterLite build for this main repo as well?
Sounds good :)
I just tried using ipyreact in jupyterlite: https://jupyterlite.readthedocs.io/en/latest/_static/lab/ installation, import and definitions work fine, but displaying a widget causes error messages. Just out of curiosity: Would it be possible to make ipyreact widgets work in JupyterLite?
whole error message: