jupyter-widgets-contrib / ipysheet

Jupyter handsontable integration
MIT License
543 stars 68 forks source link

Loading failed for ... ipysheet@~0.5.0/dist/index.js #208

Open MarcSkovMadsen opened 3 years ago

MarcSkovMadsen commented 3 years ago

With Panel==0.12.1, ipywidgets_bokeh==1.0.2, ipykernel==5.5.5 and Ipysheet==0.5.0 when I try to run the below script I get a

Loading failed for the <script> with source “https://unpkg.com/ipysheet@~0.5.0/dist/index.js”.

image

Serve the below with panel serve name_of_script.py

import panel as pn
import ipywidgets as ipw
import ipysheet

pn.extension("ipywidgets", sizing_mode="stretch_width")

accent_base_color = "#2F4F4F"
template = pn.template.FastListTemplate(
    site="Awesome Panel",
    title="IPySheet",
    accent_base_color=accent_base_color,
    header_background=accent_base_color,
    header_accent_base_color="white",
)
theme = "dark" if template.theme == pn.template.DarkTheme else "default"

def get_widget(theme="default", accent_base_color="blue"):
    slider = pn.widgets.FloatSlider(value=10, start=0, end=100)
    sheet = ipysheet.sheet()

    ipysheet.cell(1,1, "Input")
    cell3 = ipysheet.cell(1,2, 42.)
    ipysheet.cell(2,1, "Output")
    cell_sum = ipysheet.cell(2,2, 52., read_only=True, background_color=accent_base_color)

    @pn.depends(slider, cell3, watch=True)
    def calculate(a,b):
        cell_sum.value = a+b
        print("update", cell_sum.value)

    return pn.Column(slider, sheet)

widget = get_widget(theme=theme, accent_base_color=accent_base_color)
component = pn.panel(widget, height=500, sizing_mode="stretch_both")
template.main.append(component)
template.servable()
MarcSkovMadsen commented 3 years ago

Works with Ipysheet 0.4.4

https://user-images.githubusercontent.com/42288570/129837830-23184b61-7059-42e7-baa6-04e247d52016.mp4

nunupeke commented 3 years ago

Same here for voila==0.2.10. Works fine in jupyterlab and notebook though.

gbrault commented 3 years ago

Loading widget... works in Jupyterlab but not in voilà JupyterLab v3.1.13 /home/ubuntu/venv/share/jupyter/labextensions jupyterlab-plotly v5.3.1 enabled OK ipysheet v0.5.0 enabled OK (python, ipysheet) @jupyterlab/server-proxy v3.1.0 enabled OK @jupyter-widgets/jupyterlab-manager v3.0.1 enabled OK (python, jupyterlab_widgets) @voila-dashboards/jupyterlab-preview v2.0.6 enabled OK (python, voila)

philippjfr commented 3 years ago

Definitely an issue since this is where the @jupyter-widgets/html-manager tries to fetch the package from CDN:

https://github.com/jupyter-widgets/ipywidgets/blob/master/packages/html-manager/src/libembed-amd.ts#L48

giswqs commented 2 years ago

Any update on this? It would be awesome to make ipysheet compatible with Google Colab https://github.com/googlecolab/colabtools/issues/2594

DonJayamanne commented 2 years ago

Running into the same problem in VS Code, looks like the files pushed into CDN for 0.5.0 are JS modules, where as the preivous version used requirejs and included everything in the artifacts published to the CDN.

Is this an oversight os is this deliberate? I.e. should the consumers of this file on the CDN change how these files are now consumed/loaded? Not sure that will work though as there are quite a lot of missing packages (handson tables and the like)