lux-org / lux

Automatically visualize your pandas dataframe via a single print! 📊 💡
Apache License 2.0
5.15k stars 365 forks source link

Report saved with save_as_html uses non-exisiting v0.1.6 of dist.js. Panel example no longer works. #392

Closed MarcSkovMadsen closed 3 years ago

MarcSkovMadsen commented 3 years ago

I was trying to add a Lux app to my site awesome-panel.org based on https://lux-api.readthedocs.io/en/latest/source/guide/export.html?highlight=panel#exporting-to-panel.

import html

import pandas as pd
import panel as pn
import lux

pn.extension(sizing_mode="stretch_width")

df = pd.read_csv("https://raw.githubusercontent.com/lux-org/lux-datasets/master/data/hpi.csv")

def save_as_iframe(df, style="width:100%;height:100%", frameborder="0"):
    html_content = df.save_as_html(output=True)
    html_content = html.escape(html_content)
    return f"""<iframe srcdoc="{html_content}" style={style} frameborder="{frameborder}"
"allowfullscreen></iframe>"""

lux_iframe_report = save_as_iframe(df)

# Can display in notebook
lux_panel = pn.pane.HTML(lux_iframe_report, height=425)

# Can display as app with panel serve
pn.template.FastListTemplate(site="💡 Lux and Panel", title="Analysis of Happy Planet Index Dataset", main=[lux_panel]).servable();

I can see that this example no longer works as it looks for the non-existing https://unpkg.com/luxwidget@0.1.6/dist/index.js. Only version 0.1.5 exists on unpkg.

image

image

MarcSkovMadsen commented 3 years ago

I'm on lux-api 0.3.1 and lux-widget 0.1.6

MarcSkovMadsen commented 3 years ago

Workaround

Downgrading to lux-widget==0.1.5 solves the problem

dorisjlee commented 3 years ago

Hi @MarcSkovMadsen, Thanks for reporting this! I released the lux-widget 0.1.6 yesterday, but I realized that I had not updated the npm version (which the save_to_html uses, as you can see from the unpkg error). I've now released the latest version on npm too, so this should be working now! Sorry for the confusion!