import urllib.parse


def main():
    code = """\
import piplite
await piplite.install(["pyhf==0.7.0"])
%matplotlib inline
import pyhf\
"""

    parsed_url = urllib.parse.quote(code)
    url_base = "https://jupyterlite.github.io/demo/repl/index.html"
    jupyterlite_options = "?kernel=python&toolbar=1&code="
    jupyterlite_url = url_base + jupyterlite_options + parsed_url

    print(f"# jupyterlite URL:\n{jupyterlite_url}")

    jupyterlite_iframe_rst = f"""\
   <iframe
      src="{jupyterlite_url}"
      width="100%"
      height="500px"
   ></iframe>\
"""
    print(f"\n# RST for iframe for jupyterlite.rst:\n{jupyterlite_iframe_rst}")


if __name__ == "__main__":
    raise SystemExit(main())

docs/generate_jupyterlite_iframe.py
import urllib.parse


def main():
    code = """\
import piplite
await piplite.install(["pyhf==0.7.0", "matplotlib>=3.0.0"])
%matplotlib inline
import pyhf\
"""

    parsed_url = urllib.parse.quote(code)
    url_base = "https://jupyterlite.github.io/demo/repl/index.html"
    jupyterlite_options = "?kernel=python&toolbar=1&code="
    jupyterlite_url = url_base + jupyterlite_options + parsed_url

    print(f"# jupyterlite URL:\n{jupyterlite_url}")

    jupyterlite_iframe_rst = f"""\
   <iframe
      src="{jupyterlite_url}"
      width="100%"
      height="500px"
   ></iframe>\
"""
    print(f"\n# RST for iframe for jupyterlite.rst:\n{jupyterlite_iframe_rst}")


if __name__ == "__main__":
    raise SystemExit(main())

docs/generate_jupyterlite_iframe.py
diff --git a/docs/generate_jupyterlite_iframe.py b/docs/generate_jupyterlite_iframe.py
index 7770c1ee5d..fc0517ef61 100644
--- a/docs/generate_jupyterlite_iframe.py
+++ b/docs/generate_jupyterlite_iframe.py
@@ -4,7 +4,7 @@
 def main():
     code = """\
 import piplite
-await piplite.install(["pyhf==0.7.0"])
+await piplite.install(["pyhf==0.7.0", "matplotlib>=3.0.0"])
 %matplotlib inline
 import pyhf\
 """
diff --git a/docs/jupyterlite.rst b/docs/jupyterlite.rst
index 57b5fc11e3..12b227bbfa 100644
--- a/docs/jupyterlite.rst
+++ b/docs/jupyterlite.rst
@@ -21,7 +21,7 @@ Try out now with JupyterLite_
 .. raw:: html
 
    <iframe
-      src="https://jupyterlite.github.io/demo/repl/index.html?kernel=python&toolbar=1&code=import%20piplite%0Aawait%20piplite.install%28%5B%22pyhf%3D%3D0.7.0%22%5D%29%0A%25matplotlib%20inline%0Aimport%20pyhf"
+      src="https://jupyterlite.github.io/demo/repl/index.html?kernel=python&toolbar=1&code=import%20piplite%0Aawait%20piplite.install%28%5B%22pyhf%3D%3D0.7.0%22%2C%20%22matplotlib%3E%3D3.0.0%22%5D%29%0A%25matplotlib%20inline%0Aimport%20pyhf"
       width="100%"
       height="500px"
    ></iframe>

Matplotlib broken in Pyodide demo in docs
In the docs https://pyhf.readthedocs.io/en/v0.7.0/, the Pyodide example is broken for me:
```pytb
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Cell In[1], line 3
      1 import piplite
      2 await piplite.install(["pyhf==0.7.0"])
----> 3 get_ipython().run_line_magic('matplotlib', 'inline')
      4 import pyhf

File /lib/python3.10/site-packages/IPython/core/interactiveshell.py:2369, in InteractiveShell.run_line_magic(self, magic_name, line, _stack_depth)
   2367     kwargs['local_ns'] = self.get_local_scope(stack_depth)
   2368 with self.builtin_trap:
-> 2369     result = fn(*args, **kwargs)
   2371 # The code below prevents the output from being displayed
   2372 # when using magics with decodator @output_can_be_silenced
   2373 # when the last Python token in the expression is a ';'.
   2374 if getattr(fn, magic.MAGIC_OUTPUT_CAN_BE_SILENCED, False):

File /lib/python3.10/site-packages/IPython/core/magics/pylab.py:99, in PylabMagics.matplotlib(self, line)
     97     print("Available matplotlib backends: %s" % backends_list)
     98 else:
---> 99     gui, backend = self.shell.enable_matplotlib(args.gui.lower() if isinstance(args.gui, str) else args.gui)
    100     self._show_matplotlib_backend(args.gui, backend)

File /lib/python3.10/site-packages/IPython/core/interactiveshell.py:3540, in InteractiveShell.enable_matplotlib(self, gui)
   3519 def enable_matplotlib(self, gui=None):
   3520     """Enable interactive matplotlib and inline figure support.
   3521 
   3522     This takes the following steps:
   (...)
   3538         display figures inline.
   3539     """
-> 3540     from matplotlib_inline.backend_inline import configure_inline_support
   3542     from IPython.core import pylabtools as pt
   3543     gui, backend = pt.find_gui_and_backend(gui, self.pylab_gui_select)

File /lib/python3.10/site-packages/matplotlib_inline/__init__.py:1
----> 1 from . import backend_inline, config  # noqa
      2 __version__ = "0.1.6"  # noqa

File /lib/python3.10/site-packages/matplotlib_inline/backend_inline.py:6
      1 """A matplotlib backend for publishing figures via display_data"""
      3 # Copyright (c) IPython Development Team.
      4 # Distributed under the terms of the BSD 3-Clause License.
----> 6 import matplotlib
      7 from matplotlib import colors
      8 from matplotlib.backends import backend_agg

ModuleNotFoundError: The module 'matplotlib' is included in the Pyodide distribution, but it is not installed.
You can install it by calling:
  await micropip.install("matplotlib") in Python, or
  await pyodide.loadPackage("matplotlib") in JavaScript
See https://pyodide.org/en/stable/usage/loading-packages.html for more details.
```
It used to work previously, though I can not say for sure when it last worked for me. Running on MacOS (ARM), tried Firefox and Chrome (resulting in the above), while Safari seems stuck executing the import commands provided.
