holoviz / panel

Panel: The powerful data exploration & web app framework for Python
https://panel.holoviz.org
BSD 3-Clause "New" or "Revised" License
4.7k stars 510 forks source link

DevTools failed to load source map #5018

Closed hengaini2055 closed 1 year ago

hengaini2055 commented 1 year ago

ALL software version info

OS: windows 11 Browser: Chrome Python: 3.11.3 Other virtualenv libraries:

Package                  Version
------------------------ --------
altair                   5.0.1
anyio                    3.7.0
argon2-cffi              21.3.0
argon2-cffi-bindings     21.2.0
arrow                    1.2.3
asttokens                2.2.1
async-lru                2.0.2
attrs                    23.1.0
Babel                    2.12.1
backcall                 0.2.0
beautifulsoup4           4.12.2
bleach                   6.0.0
bokeh                    3.1.1
certifi                  2023.5.7
cffi                     1.15.1
charset-normalizer       3.1.0
click                    8.1.3
colorama                 0.4.6
colorcet                 3.0.1
colour                   0.1.5
comm                     0.1.3
contourpy                1.0.7
cycler                   0.11.0
debugpy                  1.6.7
decorator                5.1.1
defusedxml               0.7.1
executing                1.2.0
fastjsonschema           2.17.1
fonttools                4.39.4
fqdn                     1.5.1
holoviews                1.16.0
hvplot                   0.8.3
idna                     3.4
ipykernel                6.23.1
ipython                  8.13.2
isoduration              20.11.0
jedi                     0.18.2
Jinja2                   3.1.2
json5                    0.9.14
jsonpointer              2.3
jsonschema               4.17.3
jupyter_client           8.2.0
jupyter_core             5.3.0
jupyter-events           0.6.3
jupyter-lsp              2.2.0
jupyter_server           2.6.0
jupyter_server_terminals 0.4.4
jupyterlab               4.0.1
jupyterlab-pygments      0.2.2
jupyterlab_server        2.22.1
katex                    0.0.4
kiwisolver               1.4.4
linkify-it-py            2.0.2
Markdown                 3.4.3
markdown-it-py           2.2.0
MarkupSafe               2.1.2
matplotlib               3.7.1
matplotlib-inline        0.1.6
mdit-py-plugins          0.3.5
mdurl                    0.1.2
mistune                  2.0.5
nbclient                 0.8.0
nbconvert                7.4.0
nbformat                 5.9.0
nest-asyncio             1.5.6
notebook_shim            0.2.3
numpy                    1.24.3
overrides                7.3.1
packaging                23.1
pandas                   2.0.2
pandocfilters            1.5.0
panel                    1.0.4
param                    1.13.0
parso                    0.8.3
pickleshare              0.7.5
Pillow                   9.5.0
pip                      23.1.2
platformdirs             3.5.1
plotly                   5.14.1
prometheus-client        0.17.0
prompt-toolkit           3.0.38
psutil                   5.9.5
pure-eval                0.2.2
pycparser                2.21
pyct                     0.5.0
Pygments                 2.15.1
pyparsing                3.0.9
pyrsistent               0.19.3
python-dateutil          2.8.2
python-json-logger       2.0.7
pytz                     2023.3
pyviz-comms              2.3.0
pywin32                  306
pywinpty                 2.0.10
PyYAML                   6.0
pyzmq                    25.1.0
requests                 2.31.0
rfc3339-validator        0.1.4
rfc3986-validator        0.1.1
Send2Trash               1.8.2
setuptools               67.7.2
six                      1.16.0
sniffio                  1.3.0
soupsieve                2.4.1
stack-data               0.6.2
tenacity                 8.2.2
terminado                0.17.1
tinycss2                 1.2.1
toolz                    0.12.0
tornado                  6.3.2
tqdm                     4.65.0
traitlets                5.9.0
typing_extensions        4.6.2
tzdata                   2023.3
uc-micro-py              1.0.2
uri-template             1.2.0
urllib3                  2.0.2
wcwidth                  0.2.6
webcolors                1.13
webencodings             0.5.1
websocket-client         1.5.2
wheel                    0.40.0
xyzservices              2023.5.0

Description of expected behavior and the observed behavior

The code as follows:

import panel as pn
import pandas as pd
import altair as alt
import plotly.graph_objects as go

from bokeh.sampledata import stocks
from matplotlib.figure import Figure

pn.extension('plotly', 'vega', 'tabulator', template='bootstrap')
import hvplot.pandas

tickers = ['AAPL', 'FB', 'GOOG', 'IBM', 'MSFT']

def get_df(ticker, window_size):
    df = pd.DataFrame(getattr(stocks, ticker))
    df['date'] = pd.to_datetime(df.date)
    return df.set_index('date').rolling(window=window_size).mean().reset_index()

def get_altair(ticker, window_size):
    df = get_df(ticker, window_size)
    return alt.Chart(df).mark_line().encode(x='date', y='close').properties(
        width="container", height=400
    )

def get_hvplot(ticker, window_size):
    df = get_df(ticker, window_size)
    return df.hvplot.line('date', 'close', grid=True, responsive=True, height=400)

def get_mpl(ticker, window_size):
    fig = Figure(figsize=(10, 6))
    ax = fig.subplots()
    df = get_df(ticker, window_size)
    df.plot.line('date', 'close', ax=ax)
    return fig

def get_plotly(ticker, window_size):
    df = get_df(ticker, window_size)
    return go.Scatter(x=df.date, y=df.close)

plot_fns = {
    'altair': get_altair,
    'hvplot': get_hvplot,
    'matplotlib': get_mpl,
    'plotly': get_plotly
}

backend = pn.widgets.Select(name='Backend', options=plot_fns)
ticker = pn.widgets.Select(name='Ticker', options=['AAPL', 'FB', 'GOOG', 'IBM', 'MSFT'])
window = pn.widgets.IntSlider(name='Window', value=6, start=1, end=21)

def update(event):
    row[1] = pn.panel(backend.value(ticker.value, window.value), sizing_mode='stretch_width')

backend.param.watch(update, 'value')
ticker.param.watch(update, 'value')
window.param.watch(update, 'value')

# st = pn.widgets.Tabulator(get_df('IBM', 6), page_size=5)

row = pn.Row(
    pn.Column(backend, ticker, window),
    pn.panel(backend.value(ticker.options[0], window.value))
)

# row2 = pn.Column(row, st)

row.servable()

Complete, minimal, self-contained example code that reproduces the issue

panel serve st.py --autoreload

Stack traceback and/or browser JavaScript console output

Screenshots or screencasts of the bug in action

image

philippjfr commented 1 year ago

We do not ship the source maps as to avoid bloating the size of the Panel package any further. Do you actually need these sourcemaps or are you simply worried by those warnings?

hengaini2055 commented 1 year ago

I only worry by these warnings!