Repository: holoviz/panel

Issue:
Unify JupyterLite Install Instructions
### Description

Instructions on installing Panel in a (Pyodide-based) JupyterLite environment are presently both outdated and broken.

There are two different outdated scripts (for Panel versions <1.0.0) at:

- [ ] [Setting up JupyterLite](https://panel.holoviz.org/how_to/wasm/jupyterlite.html#optimized-wheels-optional)
- [ ] [Installing Panel in the browser](https://panel.holoviz.org/how_to/wasm/standalone.html#pyodide)

If I try to install those into a JupyterLite Pyodide environment, I get:

```
await micropip.install("https://cdn.holoviz.org/panel/0.14.0/wheels/panel-0.14.0-py3-none-any.whl", keep_going=True)
```

```
ValueError: Can't fetch wheel from 'https://cdn.holoviz.org/panel/0.14.0/wheels/panel-0.14.0-py3-none-any.whl'.
One common reason for this is when the server blocks Cross-Origin Resource Sharing (CORS).
Check if the server is sending the correct 'Access-Control-Allow-Origin' header.
```

On the other hand, if I try to install the Bokeh and Panel `py3-none-any` wheels directly from pip, I get an error related to python packages that have not yet been compiled for WASM:

```
micropip.install("https://files.pythonhosted.org/packages/56/98/da78cec88a7c47b761c9b3a18677b5508ef17417184396b3d1361fc811f1/bokeh-3.2.0-py3-none-any.whl", keep_going=True)
```

```
File /lib/python3.11/site-packages/micropip/_micropip.py:580, in install(requirements, keep_going, deps, credentials, pre)
    578 if transaction.failed:
    579     failed_requirements = ", ".join([f"'{req}'" for req in transaction.failed])
--> 580     raise ValueError(
    581         f"Can't find a pure Python 3 wheel for: {failed_requirements}\n"
    582         f"See: {FAQ_URLS['cant_find_wheel']}\n"
    583     )
    585 wheel_promises = []
    586 # Install built-in packages

ValueError: Can't find a pure Python 3 wheel for: 'contourpy>=1', 'tornado>=5.1'
See: https://pyodide.org/en/stable/usage/faq.html#micropip-can-t-find-a-pure-python-wheel
```

```
micropip.install("https://files.pythonhosted.org/packages/90/a3/cc9cfdf1b18e5456a0ebd9370baa0a5d58501b4904fa3b3d1ecccbdbd1a2/panel-1.1.1-py2.py3-none-any.whl", keep_going=True)
```

```
File /lib/python3.11/site-packages/micropip/_micropip.py:580, in install(requirements, keep_going, deps, credentials, pre)
    578 if transaction.failed:
    579     failed_requirements = ", ".join([f"'{req}'" for req in transaction.failed])
--> 580     raise ValueError(
    581         f"Can't find a pure Python 3 wheel for: {failed_requirements}\n"
    582         f"See: {FAQ_URLS['cant_find_wheel']}\n"
    583     )
    585 wheel_promises = []
    586 # Install built-in packages

ValueError: Can't find a pure Python 3 wheel for: 'contourpy>=1', 'tornado>=5.1'
See: https://pyodide.org/en/stable/usage/faq.html#micropip-can-t-find-a-pure-python-wheel
```


#### Describe the solution you'd like

A working, unified script pointing to the latest version of Panel and Bokeh.

#### Describe alternatives you've considered

N/A

#### Additional context

Try the installation for yourself at https://jupyterlite.readthedocs.io/en/latest/_static/lab/index.html



Discussion:
As per the discussion [at the Holoviz Discourse](https://discourse.holoviz.org/t/panel-wasm-setup-pyodide-jupyterlite-installation/5679/2), the following wheels work just fine:
```
https://cdn.holoviz.org/panel/1.2.0/dist/wheels/bokeh-3.2.0-py3-none-any.whl
https://cdn.holoviz.org/panel/1.2.0/dist/wheels/panel-1.2.0-py3-none-any.whl
```


Resolving patch:
diff --git a/doc/conf.py b/doc/conf.py
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -199,6 +199,19 @@ def patched_card_run(self):
 
 CardDirective.run = patched_card_run
 
+def update_versions(app, docname, source):
+    # Inspired by: https://stackoverflow.com/questions/8821511
+    version_replace = {
+       "{{PANEL_VERSION}}" : PY_VERSION,
+       "{{BOKEH_VERSION}}" : BOKEH_VERSION,
+       "{{PYSCRIPT_VERSION}}" : "2022.12.1",
+       "{{PYODIDE_VERSION}}" : "0.23.4",
+    }
+
+    for old, new in version_replace.items():
+        source[0] = source[0].replace(old, new)
+
+
 def setup(app) -> None:
     try:
         from nbsite.paramdoc import param_formatter, param_skip
@@ -207,6 +220,7 @@ def setup(app) -> None:
     except ImportError:
         print('no param_formatter (no param?)')
 
+    app.connect('source-read', update_versions)
     nbbuild.setup(app)
     app.add_config_value('grid_item_link_domain', '', 'html')
 


Test patch: