-
Notifications
You must be signed in to change notification settings - Fork 43
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
Add files for a JupyterLite demo #451
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for anywidget canceled.
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #451 +/- ##
==========================================
- Coverage 98.45% 97.21% -1.25%
==========================================
Files 8 8
Lines 452 502 +50
==========================================
+ Hits 445 488 +43
- Misses 7 14 +7 ☔ View full report in Codecov by Sentry. |
Actually this can already easily be tested on any JupyterLite deployment that has |
Wow, this is fantastic! I looked into setting up a JupyterLite notebook a while back but ran into some hiccups getting the frontend JS for anywidget to be discovered by the kernel. I'm guessing you need a preconfigured JupyterLite instance with this enabled. Overall, I'd love to build "the notebook" for teaching widgets (via anywidget). It would be awesome to have this live in a single Jupyter notebook that we could link folks to to learn about specific widget concepts. In theory, we could refer to this rather than "Jupyter Widgets: the good parts" section of the documentation. |
Yes, the Playing a bit more with it, it actually supports reading files that can be edited from the UI directly (but no HMR): anywidget-jupyterlite-files.webm |
Wow, this is great! I wouldn't expect HMR to work (although it would be slick), but the ability to sketch out a widget entirely in the browser is really really nice. I might start using this to hack out some widget ideas. With the ability to pip install python packages and import js packages via ESM.sh, it's really powerful prototyping environment. |
Indeed this would be a low-friction way for trying something out quickly! @manzt how do you see something like this integrated in the repo? I quickly looked into adding this to the Astro docs site: Although this would require installing the This could complicate the Netlify build and setup. Maybe a first step could be to deploy this JupyterLite demo to GitHub pages, and link to a full blown JupyterLite from anywidget.dev? |
For reference it's possible to run the |
Just put up a self-contained demo here: https://github.com/jtpio/anywidget-lite |
This is great. I have kind of a hectic week so I might be a bit blocked on thinking about integrating into the documentation. However, I really like the idea. We have a "notebook" section to the docs, which prerenders notebooks in the astro site. I'd probably be in favor of moving that section to embedded JupyterLite, and we could start added notebooks that illustrate specific widget concepts with anywidget. I'd like to imagine "the notebook" which covers all aspects of widgets. Kind of like the Svelte tutorial or the Rust Book. |
b8bf0af
to
263e583
Compare
|
Opening this PR early (still as a draft) to see if there would be an interest to offer a JupyterLite demo, so users can try
anywidget
in the browser easily.This demo is based on
jupyterlite-xeus
(https://jupyterlite-xeus.readthedocs.io) and installsanywidget
from conda-forge, so the example notebook works without additional code.For now it likely only support inline
_esm
and_css
, but should let users author a simple widget in their browser. Maybe there could then be a way to to "mount" additional files (such asindex.js
andindex.css
) so they are editable in JupyterLab, and correctly picked up byanywidget
.Here is a demo screencast:
anywidget-jupyterlite-demo.webm
If there is interest, I can look into integrating this with the existing documentation (maybe even inline a notebook in the docs somewhere).
TODO