holoviz-dev / nbsite

Build a tested, sphinx-based website from notebooks
https://nbsite.pyviz.org
BSD 3-Clause "New" or "Revised" License
28 stars 14 forks source link

Reapply warning suppression at the website building level #312

Open droumis opened 3 weeks ago

maximlt commented 2 weeks ago

nbsite has a feature that allows to inject some startup code that is executed before running the cells of a notebook evaluated with the NotebookDirective. It even ships with a default startup file that ignores all warnings.

import warnings

warnings.filterwarnings("ignore")

import matplotlib as mpl

mpl.use('agg')

try:
    import holoviews.plotting.bokeh  # noqa
except Exception:
    pass

try:
    import holoviews.plotting.mpl as hmpl
    hmpl.MPLPlot.fig_alpha = 0
except Exception:
    pass

There are now some HoloViz websites (param, hvplot, examples) whose notebook (and MyST Markdown) pages are no longer built with nbsite and its NotebookDirective but directly with sphinx and https://github.com/executablebooks/MyST-NB. As far as I can see, they do not offer this startup configuration feature that nbsite has. We need to find a way to enable that, opening an issue on MyST-NB (or wherever it's relevant) would make sense too.