Importing an npm module into a notebook? #4
Replies: 5 comments
-
You can import it like so: import niivue from "npm:@niivue/niivue"; |
Beta Was this translation helpful? Give feedback.
-
thanks for the feedback! |
Beta Was this translation helpful? Give feedback.
-
This is probably because Deno has |
Beta Was this translation helpful? Give feedback.
-
I'd need to play with niivue to know for sure, but I think this relates to denoland/deno#20592. We need to support comms in order to have bidirectional communication with a widget like this and the package needs to be rendered on the client, not on the Deno side. An initial prototype way to use anywidget in Deno is in https://deno.land/x/anywidget@0.0.5 |
Beta Was this translation helpful? Give feedback.
-
For clarity, Jupyter Widgets connect a Jupyter front-end (VSCode, browser) with objects in the Jupyter kernel (Python, R, Deno, ...). The Deno integration implements a kernel. However, JS libraries that are intended to run in client (i.e., most interactive visualization libraries that use Canvas API or WebGL) still need to run in the client (unless Deno implements these WebAPIs like @bartlomieju mentioned, but such implementations probably wouldn't be what is desired in this context of an interactive Jupyter notebooks). The Deno kernel lets you bridge client/kernel more conveniently because it's the same language/stack, but you need to be mindful of what packages are meant to run where. You could take your existing client bundle ( |
Beta Was this translation helpful? Give feedback.
-
hi @rgbkrk,
I was wondering: the docs say https://docs.deno.com/runtime/manual/tools/jupyter
How can I do this import from npm?
E.g. I'd like to import this module: https://www.npmjs.com/package/@niivue/niivue
I've already made a python widget from niivue that using anywidget, but would be interesting to see that working in a deno kernel as well:
294898453-08c3d466-1ca1-44cf-a57d-9e2203c3d335.mov
this tweet mentioned a few months ago that something like this might be possible
https://twitter.com/KyleRayKelley/status/1708319670535877070
is there an example somewhere that you can point me to?
Thanks a lot!
Beta Was this translation helpful? Give feedback.
All reactions