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

usage with voici #37

Closed
datakurre opened this issue Jan 8, 2025 · 11 comments
Closed

usage with voici #37

datakurre opened this issue Jan 8, 2025 · 11 comments
Labels
documentation Improvements or additions to documentation

Comments

@datakurre
Copy link

Any change / experiences that this has been tried out with https://github.com/voila-dashboards/voici and what kind of custom steps it could required?

@datakurre datakurre added the documentation Improvements or additions to documentation label Jan 8, 2025
@bollwyvl
Copy link
Collaborator

To do what it does, voici has a lot of opinions about paths and kernels. It looks like a number of jupyterlite-pyodide-kernel features break when used in voici, today. So probably no, nothing is going to work with any configuration of current releases.

@datakurre
Copy link
Author

Thanks! This is good to know, and enough for now.

That said, thank you for jupyterlite-pyodide-lock. I was able to use the lock files it leaves to create somewhat maintainable nix-packaging for jupyterlite with pyodide based environments.

@bollwyvl
Copy link
Collaborator

bollwyvl commented Jan 12, 2025 via email

@datakurre
Copy link
Author

datakurre commented Jan 13, 2025 via email

@bollwyvl
Copy link
Collaborator

Made a PR to voici:

voila-dashboards/voici#138

make Lite UI more minimal

Welp, voici is about as minimal a UI as it gets without writing your own JS and CSS.

The problem with "just" hiding most of the UI is that without being able to control everything, it won't work for the general case.

At its core, the UX for the IPython terminal, Lab, Notebook, Console, Voici, various "slides" layers, etc. are all subsets of some underlying state machine. Eventually that whole thing needs to get hoisted up, made declarative with a schema, and then we can build whatever we want with it... but for now, Lite needs to stay pretty laser focused on "serve a REPL against a fake linux computer in your browser" with varying amounts of chrome wrapped around it, and do absolutely as little as possible beyond trying to make it "work like Lab and Notebook".

hide most of the user interface

As a Lite site owner, you own the HTML. One can:

  • make an overrides.json which to disable whole UI features
  • bop a <style> (or <link>) tag in the HTML after jupyter lite build, and go to town with what should be hidden on a specific page
    • Lite declares very few novel CSS values, so pretty much all of the variables are fair game

auto-execute the notebook

Again, this is what voici does, with a predictable pattern that is replicable with a server-based kernel.

As with Lab core, we've been pushing fairly hard against any auto-running behavior in Lite, as failures become irrecoverable/undiagnosable once "most" of the UI is taken away. There are additional extensions that do this, but I don't have any recommendations.

@datakurre
Copy link
Author

@bollwyvl Thanks for the pull and comprehensive answer!

I'll take another look on voici with your pull request before trying to re-invent the wheel with way worse hacks than what voici already does.

Also, I was not sure, which parts of JupyterLite could be configured with configuration files and which by customizing the end result (or with custom Python package which registers custom pydoit-tasks).

@bollwyvl
Copy link
Collaborator

which parts of JupyterLite could be configured

Pretty much anything is fair game.

The high road is always using pip-installable extensions that already work for regular JupyterLab/Notebook 7, and would get picked up from the outer environment, would have matching verisons, copied to the right place, etc.

After that, one can get rather deep in the weeds with custom addons: while it's possible to write these as a bag of magic-named functions (e.g. pre_build, build, post_build), generally using the BaseAddon will provide a bit more context and configurability.

The most aggressive thing is to make a custom dodo.py. This allows a project to do pretty much anything, at any point in the chain of tasks, using the doit CLI instead of jupyter lite build.

@datakurre
Copy link
Author

It seems that jupyterlite-pyodide-lock works well with voici with the patch ❤️

@bollwyvl
Copy link
Collaborator

Cool. Certainly wasn't this guy that wrote it directly into .pixi/envs/docs/lib/python-3.13/site-packages/voici_core and then copied it into a PR...

@Justyouraveragehomie
Copy link

Hey all, so this works with Voici now? A little confused on what the full setup is .....you have ipywidgets working?

@bollwyvl
Copy link
Collaborator

As of today, the above comment is still accurate:

So probably no, nothing is going to work with any configuration of current releases.

If a new version of voici-core is released which includes voila-dashboards/voici#137, then the current version of jupyterlite-pyodide-lock will very likely work. As always, some caveats: a new version of pyodide (and subsequently jupyterlite-pyodide-kernel) was released today, and has not been tested as part of this repo, but as upstream lock still pins to micropip 0.8.0, there should be no reason to suspect any breakage with all the configuration defaults.

All of the above is... part of the very compelling reason to choose to make very sure a build environment using jupyterlite-pyodide-lock is reproducible with an outer lockfile... a tool like uv will get you pretty far (to the python library version) while heavier-weight tools such as nix or pixi can go further, up to the browser (and/or webdriver) used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

3 participants