Support importing in pyodide
See original GitHub issueProblem
I am a contributor to and user of HoloViz Panel. Panel works with Ipywidgets. Panel can now convert panel apps to webassembly.
BUT it seems I cannot include ipywidgets in those converted apps.
For example if I open the pyodide console and try to
import micropip
micropip.install("ipywidgets")
it fails
....
raise ValueError(
ValueError: Can't find a pure Python 3 wheel for 'tornado>=6.1'.
See: https://pyodide.org/en/stable/usage/faq.html#micropip-can-t-find-a-pure-python-wheel
You can use `micropip.install(..., keep_going=True)`to get a list of all packages with missing wheels.
Proposed Solution
Support importing ipywidgets in pyodide.
Additional context
In the end I would like to be able to panel convert apps like
"""
The purpose of this app is to demonstrate that Panel works with the tools you know and love
❤️, including ipysheet.
"""
import ipysheet
import panel as pn
from awesome_panel import config
config.extension("ipywidgets", url="lib_ipysheet")
ACCENT = config.ACCENT
def get_component(accent_base_color=ACCENT):
"""Returns an ipysheet app"""
slider = pn.widgets.FloatSlider(value=10, start=0, end=100)
sheet = ipysheet.sheet()
ipysheet.cell(1, 1, "Input")
cell3 = ipysheet.cell(1, 2, 42.0)
ipysheet.cell(2, 1, "Output")
cell_sum = ipysheet.cell(2, 2, 52.0, read_only=True, background_color=accent_base_color)
@pn.depends(slider, cell3, watch=True)
def calculate(value1, value2):
cell_sum.value = value1 + value2
return pn.Column(slider, sheet)
component = get_component()
pn.panel(component, height=700, sizing_mode="stretch_both").servable()
and provide a Basic Ipywidgets App example at https://www.awesome-panel.org/sharing
Originally opened here https://github.com/QuantStack/ipysheet/issues/236.
Issue Analytics
- State:
- Created a year ago
- Comments:10 (7 by maintainers)
Top Results From Across the Web
Loading packages — Version 0.21.3 - Pyodide
loadPackagesFromImports Pyodide will automatically download all packages that the code snippet imports. This is particularly useful for making a repl since ...
Read more >How do I import modules in a project using pyodide without ...
runPythonAsync function that will automatically download all packages that the code snippet imports. Here is the minimal example for pyodide.
Read more >Support importing pyodide as ESM module #2217 - GitHub
Feature This is to propose supporting loading pyodide.js as ESM module. Majority of modern browsers support ESM modules via script: can i ...
Read more >Pyodide - Read the Docs
After importing Pyodide, only packages from the standard library are ... Pyodide works in any modern web browser with WebAssembly support.
Read more >Running Panel in the Browser with WASM - GitHub Pages
Panel can be run directly in Pyodide and has special support for rendering ... and packages (relative imports of other scripts or modules...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sorry I read the thread too fast.
So yeah as other said removing the ipykernel dependency or providing a shim for it would be what you need.
https://github.com/widgetti/solara/blob/ce456e0fed4e0dde6df486d830eca9044b25eb71/solara/server/static/solara_bootstrap.py was my quick iterate and hack attempt. Maybe that’s helpful.