AaronWatters / jp_proxy_widget

Generic Jupyter/IPython widget implementation that will support many types of javascript libraries and interactions.
BSD 2-Clause "Simplified" License
61 stars 12 forks source link

Installing in JupyterLite #33

Closed psychemedia closed 2 years ago

psychemedia commented 2 years ago

Do you know whether jp_proxy_widget should in principle be able to run in JupyterLite, the WASM powered JupyterLab environment?

The current wheel doesn't install in JupyterLite.

I also note that you make use of requests in the code; requests doesn't run out of the can in pyodide (at least, it didn't last time I checked) so I'm guessing that is one thing that might need refactoring (or otherwise addressing) for a version of jp_proxy_widget capable of running in JupyterLite.

AaronWatters commented 2 years ago

I don't know. jp_proxy_widgets mainly depends on the standard infrastructure, so maybe you could make a fork with stuff disabled to work.

If the Lite version does not support persistent filesystems and internet protocols seamlessly I'm not sure it has realistic use cases outside of "gee whiz that's cool!" But this is coming from the guy who once thought smart phones was a dumb idea ;c).

BTW: please check out my latest thing sometime and let me know what you think

https://github.com/AaronWatters/H5Gizmos

psychemedia commented 2 years ago

Re: utility of jupyterlite: it's already used by numpy et al as part of their get-startes documentation..;-)

AaronWatters commented 2 years ago

If they asked me I would advise against using the lite version for anything except heavily caveated simple demos. Many users (including PhD scientists) already find the Jupyter environment extremely confusing and scary and this just makes things more confusing and scary for everyone who hasn't drunk the koolaid. I'm not even sure it's a good idea for the "try me" button...

One of the first things I would want to do with Jupyter would be to download some data from a website somewhere (other than where the Jupyter image came from) and the browser same origin restriction is specifically designed to prevent this. So the user has to keep in mind a whole collection of things they can and can't do in different flavors of Jupyter...

I would prefer that they make things simpler rather than more complicated.

But of course they are not asking me.

AaronWatters commented 2 years ago

However, I would be delighted if you would fork jp_proxy_widgets to see if it is possible to make (part of it) work under the lite version. I might try this eventually, but I have higher priorities at the moment.

psychemedia commented 2 years ago

There are certainly quite a lot of workarounds required at the moment to do with file handling, the need to call certain functions as async functions, the inability to use %pip magic (and the caveats on generic wheels), the myriad file systems that are in play (in-memory, browser storage, local filesystem) and that are inconsistent with each other, etc etc. The pandas folk were looking at using JupyterLite but atm the file handling seems to be a blocker, for example.

But at the same time, there is no requirement on a server other than a simple web server, which helps both the publisher and the user, although there is a large download required and you do need a reasonable amount of memory.

There's a lot of other interesting work i pure-browser apps and Python coding atm. Pyscript, of course, and a really interesting in-browser deployment of datasette as datasette-lite.

As all these things are built of pyodide, it may be that workarounds can be found at the pyodide level to address some of the issue. In addition, it may be that more package providers start to feel they have to build in support for pyodide runtimes.