Minimal Examples¶
Skill version 0.1.0
A reproducer a tester pastes and runs unchanged to check a fix, so keep it short enough to skim, not study. These are the traps specific to HoloViz reproducers.
- Render explicitly with
pn.serve(obj); don't end on the bare object. In a script the notebook_repr_html_never fires, soobjalone does nothing and any render-time error (layout sizing, projection, aspect, colorbar) stays hidden.pn.serverenders any HoloViews/hvPlot/Panel object and surfaces it. - Declare the backend the behavior depends on (
hv.extension('bokeh')vs'matplotlib'). The same code renders through different code paths per backend, so an implicit backend makes the report ambiguous. - Generate data inline and seed it (
rng = np.random.default_rng(0)), or load a dataset the reader can fetch too, e.g. a URL,xr.tutorial.open_dataset, orbokeh.sampledata. Just don'tread_csva local path only you have. - For a bug, paste the versions that matter (
hv.__version__,pn.__version__, and the backend: bokeh/matplotlib/cartopy). HoloViz bugs are usually version-specific. - End with a one-line comment on the before behavior (what a tester sees without the fix) and the after (what a correct run should show), so they know what to look for without studying the code.
import numpy as np, pandas as pd, holoviews as hv, panel as pn
hv.extension('bokeh') # backend the behavior depends on
rng = np.random.default_rng(0)
df = pd.DataFrame({'x': rng.normal(size=20), 'y': rng.normal(size=20)})
pn.serve(hv.Scatter(df, 'x', 'y')) # force render; raises the error if present
# Before: raises ValueError / renders blank.
# After: shows a scatter of 20 points.