Proof of Concept Feedback Thread
coatless opened this issue · 6 comments
Have some feedback that you want to share about the proof of concept for the pyodide
extension?
https://rd.thecoatlessprofessor.com/pyodide-quarto-demo/
Feel free to leave a comment here!
Thanks for working on this! I'm curious about the graphing limitations; are these limited to raster based libraries like matplotlib, or do they also include web native libraries like altair?
I tried exploring this myself following the instructions at https://shiny.posit.co/py/docs/shinylive.html#testing-whether-a-package-is-available to install altair, but I run into errors with the installation (which I also reported posit-dev/py-shiny#890).
@joelostblom the issue is due to how images are being saved to a canvas in pyodide
. Specifically, each downstream project needs to patch the matplotlib
output to redirect it onto the designated area. Moreover, unlike with webr
, the documentation for working with images is sparse; worse yet, many of the examples are out of date.
So, when the POC was made in ~Early August, this moved over to the back burner.
Interesting, since you mentioned images specifically, do you think it would be easier with the libraries that don't display charts as a raster image, but rather svg/html etc (such as altair, plotly, bokeh)? Or do they still need to go through the same image/matplotlib redirect?
The first issue with using an external package is whether it is available via either a pure Python wheel or wasm32/emscripten wheel. If it is, then we should be able to install it either via micropip.install()
or through a requirements.txt
file.
From there, it's a matter of understanding how the output of the package is being handled. Right now, this can be split into two camps:
- we need to pre-load the package when initializing
pyodide
alongside a patch to handle the output; or, - the data is likely being sent out as raw text that can be immediately incorporated into the document.
So, in the case of 2., it's likely easier as everything should just work assuming the rendered output is added into the DOM using innerHTML
instead of innerText
.
Great, thanks for elaborating on how it works!
@joelostblom Feel free to check out the {quarto-pyodide}
extension.
Install instructions are here:
https://github.com/coatless-quarto/pyodide
Rendered demos using the extension:
https://quarto.thecoatlessprofessor.com/pyodide/qpyodide-code-cell-demo.html