using jupyterlab components #285
-
Hi, Ive been trying the following as my starting point, but my hunch is this isn't possible or the wrong way to go about it.
i get this error
It would be great to have a simple example of using anywidget to interact with Jupyter itself. I think that is something others will find useful. Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
Hi there. Yes, you just need to add the import anywidget
class ExampleWidget(anywidget.AnyWidget):
# anywidget, required #
_esm = """
import * as jlab from "https://esm.sh/@jupyterlab/[email protected]?bundle";
export function render() {
console.log(jlab);
}
"""
ExampleWidget() I'd like to keep the issues in this repo related to anywidget and not debugging JS modules that aren't related to the project if possible! |
Beta Was this translation helpful? Give feedback.
-
Thanks for the help. Sorry that the question wasn't closely enough related to the project. I did hesitate to ask the question but ultimately I thought there wasn't anywhere else better to ask about how to interact with jupyter from anywidget. Anywidget has made it very easy for a jupyter user to experiment in making widgets and many could be python not js users so i think it likely there will be quite a few issues posted that are only peripherally related to anywidget. If you are looking for ideas for further examples to include in the documentation I think one that works with the jupyter interface would be interesting. |
Beta Was this translation helpful? Give feedback.
-
No need to apologize at all! I'm sorry if I was short in my response. This thread (and others) led me to open Discussions for such queries in the future. Thanks for giving anywidget a try.
Totally agree!
I've never tried this type of integration. Do you have any examples you could share? |
Beta Was this translation helpful? Give feedback.
Hi there. Yes, you just need to add the
?bundle
query param since @jupyterlab/application isn't properly packaged for npm as ESM. I recommend reading the https://esm.sh/ documentation to learn more about their API if you plan to use dependencies from that CDN. (Although I'm not sure how this module interacts with the juptyer front end).I'd like to keep the issues in this repo related to anywidget and not debugging JS module…