We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN 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


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `doc/conf.py`
Content:
```
1 import json
2 import os
3 import pathlib
4 
5 import param
6 
7 param.parameterized.docstring_signature = False
8 param.parameterized.docstring_describe_params = False
9 
10 from nbsite.shared_conf import *
11 
12 project = 'Panel'
13 authors = 'Panel contributors'
14 copyright_years['start_year'] = '2019'
15 copyright = copyright_fmt.format(**copyright_years)
16 description = 'High-level dashboarding for python visualization libraries'
17 
18 import panel
19 
20 from panel.io.convert import BOKEH_VERSION, MINIMUM_VERSIONS, PY_VERSION
21 from panel.io.resources import CDN_DIST
22 
23 PANEL_ROOT = pathlib.Path(panel.__file__).parent
24 
25 version = release = base_version(panel.__version__)
26 js_version = json.loads((PANEL_ROOT / 'package.json').read_text())['version']
27 
28 is_dev = any(ext in version for ext in ('a', 'b', 'rc'))
29 
30 # For the interactivity warning box created by nbsite to point to the right
31 # git tag instead of the default i.e. main.
32 os.environ['BRANCH'] = f"v{release}"
33 
34 html_static_path += ['_static']
35 
36 html_css_files += [
37     'css/custom.css',
38 ]
39 
40 html_theme = "pydata_sphinx_theme"
41 html_favicon = "_static/icons/favicon.ico"
42 
43 html_theme_options = {
44     "logo": {
45         "image_light": "_static/logo_horizontal_light_theme.png",
46         "image_dark": "_static/logo_horizontal_dark_theme.png",
47     },
48     "github_url": "https://github.com/holoviz/panel",
49     "icon_links": [
50         {
51             "name": "Twitter",
52             "url": "https://twitter.com/Panel_Org",
53             "icon": "fa-brands fa-twitter-square",
54         },
55         {
56             "name": "Discourse",
57             "url": "https://discourse.holoviz.org/c/panel/5",
58             "icon": "fa-brands fa-discourse",
59         },
60         {
61             "name": "Discord",
62             "url": "https://discord.gg/UXdtYyGVQX",
63             "icon": "fa-brands fa-discord",
64         },
65     ],
66     "analytics": {"google_analytics_id": "G-L0C8PGT2LM"},
67     "pygment_light_style": "material",
68     "pygment_dark_style": "material",
69     "header_links_before_dropdown": 5,
70     'secondary_sidebar_items': [
71         "github-stars-button",
72         "panelitelink",
73         "page-toc",
74     ],
75 }
76 
77 extensions += [
78     'sphinx.ext.napoleon',
79     'nbsite.gallery',
80     'sphinx_copybutton',
81     'nbsite.pyodide'
82 ]
83 napoleon_numpy_docstring = True
84 
85 myst_enable_extensions = ["colon_fence", "deflist"]
86 
87 gallery_endpoint = 'panel-gallery-dev' if is_dev else 'panel-gallery'
88 gallery_url = f'https://{gallery_endpoint}.pyviz.demo.anaconda.com'
89 jlite_url = 'https://pyviz-dev.github.io/panelite-dev' if is_dev else 'https://panelite.holoviz.org'
90 pyodide_url = 'https://pyviz-dev.github.io/panel/pyodide' if is_dev else 'https://panel.holoviz.org/pyodide'
91 
92 nbsite_gallery_conf = {
93     'github_org': 'holoviz',
94     'github_project': 'panel',
95     'galleries': {
96         'reference': {
97             'title': 'Component Gallery',
98             'sections': [
99                 'panes',
100                 'layouts',
101                 'templates',
102                 'global',
103                 'indicators',
104                 'widgets',
105             ],
106             'titles': {
107                 'Vega': 'Altair & Vega',
108                 'DeckGL': 'PyDeck & Deck.gl',
109                 'ECharts': 'PyEcharts & ECharts',
110                 'IPyWidget': 'ipywidgets'
111             },
112             'as_pyodide': True,
113             'normalize_titles': False
114         }
115     },
116     'thumbnail_url': 'https://assets.holoviz.org/panel/thumbnails',
117     'deployment_url': gallery_url,
118     'jupyterlite_url': jlite_url,
119 }
120 
121 if panel.__version__ != version and (PANEL_ROOT / 'dist' / 'wheels').is_dir():
122     py_version = panel.__version__.replace("-dirty", "")
123     panel_req = f'./wheels/panel-{py_version}-py3-none-any.whl'
124     bokeh_req = f'./wheels/bokeh-{BOKEH_VERSION}-py3-none-any.whl'
125 else:
126     panel_req = f'{CDN_DIST}wheels/panel-{PY_VERSION}-py3-none-any.whl'
127     bokeh_req = f'{CDN_DIST}wheels/bokeh-{BOKEH_VERSION}-py3-none-any.whl'
128 
129 def get_requirements():
130     with open('pyodide_dependencies.json') as deps:
131         dependencies = json.load(deps)
132     requirements = {}
133     for src, deps in dependencies.items():
134         if deps is None:
135             continue
136         src = src.replace('.ipynb', '').replace('.md', '')
137         for name, min_version in MINIMUM_VERSIONS.items():
138             if any(name in req for req in deps):
139                 deps = [f'{name}>={min_version}' if name in req else req for req in deps]
140         requirements[src] = deps
141     return requirements
142 
143 nbsite_pyodide_conf = {
144     'PYODIDE_URL': 'https://cdn.jsdelivr.net/pyodide/v0.23.1/full/pyodide.js',
145     'requirements': [bokeh_req, panel_req, 'pyodide-http'],
146     'requires': get_requirements()
147 }
148 
149 templates_path += [
150     '_templates'
151 ]
152 
153 html_context.update({
154     "last_release": f"v{release}",
155     "github_user": "holoviz",
156     "github_repo": "panel",
157     "default_mode": "light",
158     "panelite_endpoint": jlite_url,
159     "gallery_url": gallery_url,
160     "pyodide_url": pyodide_url
161 })
162 
163 nbbuild_patterns_to_take_along = ["simple.html", "*.json", "json_*"]
164 
165 # Override the Sphinx default title that appends `documentation`
166 html_title = f'{project} v{version}'
167 
168 
169 # Patching GridItemCardDirective to be able to substitute the domain name
170 # in the link option.
171 from sphinx_design.cards import CardDirective
172 from sphinx_design.grids import GridItemCardDirective
173 
174 orig_grid_run = GridItemCardDirective.run
175 
176 def patched_grid_run(self):
177     app = self.state.document.settings.env.app
178     existing_link = self.options.get('link')
179     domain = getattr(app.config, 'grid_item_link_domain', None)
180     if self.has_content:
181         self.content.replace('|gallery-endpoint|', domain)
182     if existing_link and domain:
183         new_link = existing_link.replace('|gallery-endpoint|', domain)
184         self.options['link'] = new_link
185     return list(orig_grid_run(self))
186 
187 GridItemCardDirective.run = patched_grid_run
188 
189 orig_card_run = CardDirective.run
190 
191 def patched_card_run(self):
192     app = self.state.document.settings.env.app
193     existing_link = self.options.get('link')
194     domain = getattr(app.config, 'grid_item_link_domain', None)
195     if existing_link and domain:
196         new_link = existing_link.replace('|gallery-endpoint|', domain)
197         self.options['link'] = new_link
198     return orig_card_run(self)
199 
200 CardDirective.run = patched_card_run
201 
202 def setup(app) -> None:
203     try:
204         from nbsite.paramdoc import param_formatter, param_skip
205         app.connect('autodoc-process-docstring', param_formatter)
206         app.connect('autodoc-skip-member', param_skip)
207     except ImportError:
208         print('no param_formatter (no param?)')
209 
210     nbbuild.setup(app)
211     app.add_config_value('grid_item_link_domain', '', 'html')
212 
213 grid_item_link_domain = gallery_endpoint
214
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/doc/conf.py b/doc/conf.py
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -199,6 +199,19 @@
 
 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 @@
     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')

{"golden_diff": "diff --git a/doc/conf.py b/doc/conf.py\n--- a/doc/conf.py\n+++ b/doc/conf.py\n@@ -199,6 +199,19 @@\n \n CardDirective.run = patched_card_run\n \n+def update_versions(app, docname, source):\n+    # Inspired by: https://stackoverflow.com/questions/8821511\n+    version_replace = {\n+       \"{{PANEL_VERSION}}\" : PY_VERSION,\n+       \"{{BOKEH_VERSION}}\" : BOKEH_VERSION,\n+       \"{{PYSCRIPT_VERSION}}\" : \"2022.12.1\",\n+       \"{{PYODIDE_VERSION}}\" : \"0.23.4\",\n+    }\n+\n+    for old, new in version_replace.items():\n+        source[0] = source[0].replace(old, new)\n+\n+\n def setup(app) -> None:\n     try:\n         from nbsite.paramdoc import param_formatter, param_skip\n@@ -207,6 +220,7 @@\n     except ImportError:\n         print('no param_formatter (no param?)')\n \n+    app.connect('source-read', update_versions)\n     nbbuild.setup(app)\n     app.add_config_value('grid_item_link_domain', '', 'html')\n", "issue": "Unify JupyterLite Install Instructions\n### Description\r\n\r\nInstructions on installing Panel in a (Pyodide-based) JupyterLite environment are presently both outdated and broken.\r\n\r\nThere are two different outdated scripts (for Panel versions <1.0.0) at:\r\n\r\n- [ ] [Setting up JupyterLite](https://panel.holoviz.org/how_to/wasm/jupyterlite.html#optimized-wheels-optional)\r\n- [ ] [Installing Panel in the browser](https://panel.holoviz.org/how_to/wasm/standalone.html#pyodide)\r\n\r\nIf I try to install those into a JupyterLite Pyodide environment, I get:\r\n\r\n```\r\nawait micropip.install(\"https://cdn.holoviz.org/panel/0.14.0/wheels/panel-0.14.0-py3-none-any.whl\", keep_going=True)\r\n```\r\n\r\n```\r\nValueError: Can't fetch wheel from 'https://cdn.holoviz.org/panel/0.14.0/wheels/panel-0.14.0-py3-none-any.whl'.\r\nOne common reason for this is when the server blocks Cross-Origin Resource Sharing (CORS).\r\nCheck if the server is sending the correct 'Access-Control-Allow-Origin' header.\r\n```\r\n\r\nOn 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:\r\n\r\n```\r\nmicropip.install(\"https://files.pythonhosted.org/packages/56/98/da78cec88a7c47b761c9b3a18677b5508ef17417184396b3d1361fc811f1/bokeh-3.2.0-py3-none-any.whl\", keep_going=True)\r\n```\r\n\r\n```\r\nFile /lib/python3.11/site-packages/micropip/_micropip.py:580, in install(requirements, keep_going, deps, credentials, pre)\r\n    578 if transaction.failed:\r\n    579     failed_requirements = \", \".join([f\"'{req}'\" for req in transaction.failed])\r\n--> 580     raise ValueError(\r\n    581         f\"Can't find a pure Python 3 wheel for: {failed_requirements}\\n\"\r\n    582         f\"See: {FAQ_URLS['cant_find_wheel']}\\n\"\r\n    583     )\r\n    585 wheel_promises = []\r\n    586 # Install built-in packages\r\n\r\nValueError: Can't find a pure Python 3 wheel for: 'contourpy>=1', 'tornado>=5.1'\r\nSee: https://pyodide.org/en/stable/usage/faq.html#micropip-can-t-find-a-pure-python-wheel\r\n```\r\n\r\n```\r\nmicropip.install(\"https://files.pythonhosted.org/packages/90/a3/cc9cfdf1b18e5456a0ebd9370baa0a5d58501b4904fa3b3d1ecccbdbd1a2/panel-1.1.1-py2.py3-none-any.whl\", keep_going=True)\r\n```\r\n\r\n```\r\nFile /lib/python3.11/site-packages/micropip/_micropip.py:580, in install(requirements, keep_going, deps, credentials, pre)\r\n    578 if transaction.failed:\r\n    579     failed_requirements = \", \".join([f\"'{req}'\" for req in transaction.failed])\r\n--> 580     raise ValueError(\r\n    581         f\"Can't find a pure Python 3 wheel for: {failed_requirements}\\n\"\r\n    582         f\"See: {FAQ_URLS['cant_find_wheel']}\\n\"\r\n    583     )\r\n    585 wheel_promises = []\r\n    586 # Install built-in packages\r\n\r\nValueError: Can't find a pure Python 3 wheel for: 'contourpy>=1', 'tornado>=5.1'\r\nSee: https://pyodide.org/en/stable/usage/faq.html#micropip-can-t-find-a-pure-python-wheel\r\n```\r\n\r\n\r\n#### Describe the solution you'd like\r\n\r\nA working, unified script pointing to the latest version of Panel and Bokeh.\r\n\r\n#### Describe alternatives you've considered\r\n\r\nN/A\r\n\r\n#### Additional context\r\n\r\nTry the installation for yourself at https://jupyterlite.readthedocs.io/en/latest/_static/lab/index.html\r\n\n", "before_files": [{"content": "import json\nimport os\nimport pathlib\n\nimport param\n\nparam.parameterized.docstring_signature = False\nparam.parameterized.docstring_describe_params = False\n\nfrom nbsite.shared_conf import *\n\nproject = 'Panel'\nauthors = 'Panel contributors'\ncopyright_years['start_year'] = '2019'\ncopyright = copyright_fmt.format(**copyright_years)\ndescription = 'High-level dashboarding for python visualization libraries'\n\nimport panel\n\nfrom panel.io.convert import BOKEH_VERSION, MINIMUM_VERSIONS, PY_VERSION\nfrom panel.io.resources import CDN_DIST\n\nPANEL_ROOT = pathlib.Path(panel.__file__).parent\n\nversion = release = base_version(panel.__version__)\njs_version = json.loads((PANEL_ROOT / 'package.json').read_text())['version']\n\nis_dev = any(ext in version for ext in ('a', 'b', 'rc'))\n\n# For the interactivity warning box created by nbsite to point to the right\n# git tag instead of the default i.e. main.\nos.environ['BRANCH'] = f\"v{release}\"\n\nhtml_static_path += ['_static']\n\nhtml_css_files += [\n    'css/custom.css',\n]\n\nhtml_theme = \"pydata_sphinx_theme\"\nhtml_favicon = \"_static/icons/favicon.ico\"\n\nhtml_theme_options = {\n    \"logo\": {\n        \"image_light\": \"_static/logo_horizontal_light_theme.png\",\n        \"image_dark\": \"_static/logo_horizontal_dark_theme.png\",\n    },\n    \"github_url\": \"https://github.com/holoviz/panel\",\n    \"icon_links\": [\n        {\n            \"name\": \"Twitter\",\n            \"url\": \"https://twitter.com/Panel_Org\",\n            \"icon\": \"fa-brands fa-twitter-square\",\n        },\n        {\n            \"name\": \"Discourse\",\n            \"url\": \"https://discourse.holoviz.org/c/panel/5\",\n            \"icon\": \"fa-brands fa-discourse\",\n        },\n        {\n            \"name\": \"Discord\",\n            \"url\": \"https://discord.gg/UXdtYyGVQX\",\n            \"icon\": \"fa-brands fa-discord\",\n        },\n    ],\n    \"analytics\": {\"google_analytics_id\": \"G-L0C8PGT2LM\"},\n    \"pygment_light_style\": \"material\",\n    \"pygment_dark_style\": \"material\",\n    \"header_links_before_dropdown\": 5,\n    'secondary_sidebar_items': [\n        \"github-stars-button\",\n        \"panelitelink\",\n        \"page-toc\",\n    ],\n}\n\nextensions += [\n    'sphinx.ext.napoleon',\n    'nbsite.gallery',\n    'sphinx_copybutton',\n    'nbsite.pyodide'\n]\nnapoleon_numpy_docstring = True\n\nmyst_enable_extensions = [\"colon_fence\", \"deflist\"]\n\ngallery_endpoint = 'panel-gallery-dev' if is_dev else 'panel-gallery'\ngallery_url = f'https://{gallery_endpoint}.pyviz.demo.anaconda.com'\njlite_url = 'https://pyviz-dev.github.io/panelite-dev' if is_dev else 'https://panelite.holoviz.org'\npyodide_url = 'https://pyviz-dev.github.io/panel/pyodide' if is_dev else 'https://panel.holoviz.org/pyodide'\n\nnbsite_gallery_conf = {\n    'github_org': 'holoviz',\n    'github_project': 'panel',\n    'galleries': {\n        'reference': {\n            'title': 'Component Gallery',\n            'sections': [\n                'panes',\n                'layouts',\n                'templates',\n                'global',\n                'indicators',\n                'widgets',\n            ],\n            'titles': {\n                'Vega': 'Altair & Vega',\n                'DeckGL': 'PyDeck & Deck.gl',\n                'ECharts': 'PyEcharts & ECharts',\n                'IPyWidget': 'ipywidgets'\n            },\n            'as_pyodide': True,\n            'normalize_titles': False\n        }\n    },\n    'thumbnail_url': 'https://assets.holoviz.org/panel/thumbnails',\n    'deployment_url': gallery_url,\n    'jupyterlite_url': jlite_url,\n}\n\nif panel.__version__ != version and (PANEL_ROOT / 'dist' / 'wheels').is_dir():\n    py_version = panel.__version__.replace(\"-dirty\", \"\")\n    panel_req = f'./wheels/panel-{py_version}-py3-none-any.whl'\n    bokeh_req = f'./wheels/bokeh-{BOKEH_VERSION}-py3-none-any.whl'\nelse:\n    panel_req = f'{CDN_DIST}wheels/panel-{PY_VERSION}-py3-none-any.whl'\n    bokeh_req = f'{CDN_DIST}wheels/bokeh-{BOKEH_VERSION}-py3-none-any.whl'\n\ndef get_requirements():\n    with open('pyodide_dependencies.json') as deps:\n        dependencies = json.load(deps)\n    requirements = {}\n    for src, deps in dependencies.items():\n        if deps is None:\n            continue\n        src = src.replace('.ipynb', '').replace('.md', '')\n        for name, min_version in MINIMUM_VERSIONS.items():\n            if any(name in req for req in deps):\n                deps = [f'{name}>={min_version}' if name in req else req for req in deps]\n        requirements[src] = deps\n    return requirements\n\nnbsite_pyodide_conf = {\n    'PYODIDE_URL': 'https://cdn.jsdelivr.net/pyodide/v0.23.1/full/pyodide.js',\n    'requirements': [bokeh_req, panel_req, 'pyodide-http'],\n    'requires': get_requirements()\n}\n\ntemplates_path += [\n    '_templates'\n]\n\nhtml_context.update({\n    \"last_release\": f\"v{release}\",\n    \"github_user\": \"holoviz\",\n    \"github_repo\": \"panel\",\n    \"default_mode\": \"light\",\n    \"panelite_endpoint\": jlite_url,\n    \"gallery_url\": gallery_url,\n    \"pyodide_url\": pyodide_url\n})\n\nnbbuild_patterns_to_take_along = [\"simple.html\", \"*.json\", \"json_*\"]\n\n# Override the Sphinx default title that appends `documentation`\nhtml_title = f'{project} v{version}'\n\n\n# Patching GridItemCardDirective to be able to substitute the domain name\n# in the link option.\nfrom sphinx_design.cards import CardDirective\nfrom sphinx_design.grids import GridItemCardDirective\n\norig_grid_run = GridItemCardDirective.run\n\ndef patched_grid_run(self):\n    app = self.state.document.settings.env.app\n    existing_link = self.options.get('link')\n    domain = getattr(app.config, 'grid_item_link_domain', None)\n    if self.has_content:\n        self.content.replace('|gallery-endpoint|', domain)\n    if existing_link and domain:\n        new_link = existing_link.replace('|gallery-endpoint|', domain)\n        self.options['link'] = new_link\n    return list(orig_grid_run(self))\n\nGridItemCardDirective.run = patched_grid_run\n\norig_card_run = CardDirective.run\n\ndef patched_card_run(self):\n    app = self.state.document.settings.env.app\n    existing_link = self.options.get('link')\n    domain = getattr(app.config, 'grid_item_link_domain', None)\n    if existing_link and domain:\n        new_link = existing_link.replace('|gallery-endpoint|', domain)\n        self.options['link'] = new_link\n    return orig_card_run(self)\n\nCardDirective.run = patched_card_run\n\ndef setup(app) -> None:\n    try:\n        from nbsite.paramdoc import param_formatter, param_skip\n        app.connect('autodoc-process-docstring', param_formatter)\n        app.connect('autodoc-skip-member', param_skip)\n    except ImportError:\n        print('no param_formatter (no param?)')\n\n    nbbuild.setup(app)\n    app.add_config_value('grid_item_link_domain', '', 'html')\n\ngrid_item_link_domain = gallery_endpoint\n", "path": "doc/conf.py"}], "after_files": [{"content": "import json\nimport os\nimport pathlib\n\nimport param\n\nparam.parameterized.docstring_signature = False\nparam.parameterized.docstring_describe_params = False\n\nfrom nbsite.shared_conf import *\n\nproject = 'Panel'\nauthors = 'Panel contributors'\ncopyright_years['start_year'] = '2019'\ncopyright = copyright_fmt.format(**copyright_years)\ndescription = 'High-level dashboarding for python visualization libraries'\n\nimport panel\n\nfrom panel.io.convert import BOKEH_VERSION, MINIMUM_VERSIONS, PY_VERSION\nfrom panel.io.resources import CDN_DIST\n\nPANEL_ROOT = pathlib.Path(panel.__file__).parent\n\nversion = release = base_version(panel.__version__)\njs_version = json.loads((PANEL_ROOT / 'package.json').read_text())['version']\n\nis_dev = any(ext in version for ext in ('a', 'b', 'rc'))\n\n# For the interactivity warning box created by nbsite to point to the right\n# git tag instead of the default i.e. main.\nos.environ['BRANCH'] = f\"v{release}\"\n\nhtml_static_path += ['_static']\n\nhtml_css_files += [\n    'css/custom.css',\n]\n\nhtml_theme = \"pydata_sphinx_theme\"\nhtml_favicon = \"_static/icons/favicon.ico\"\n\nhtml_theme_options = {\n    \"logo\": {\n        \"image_light\": \"_static/logo_horizontal_light_theme.png\",\n        \"image_dark\": \"_static/logo_horizontal_dark_theme.png\",\n    },\n    \"github_url\": \"https://github.com/holoviz/panel\",\n    \"icon_links\": [\n        {\n            \"name\": \"Twitter\",\n            \"url\": \"https://twitter.com/Panel_Org\",\n            \"icon\": \"fa-brands fa-twitter-square\",\n        },\n        {\n            \"name\": \"Discourse\",\n            \"url\": \"https://discourse.holoviz.org/c/panel/5\",\n            \"icon\": \"fa-brands fa-discourse\",\n        },\n        {\n            \"name\": \"Discord\",\n            \"url\": \"https://discord.gg/UXdtYyGVQX\",\n            \"icon\": \"fa-brands fa-discord\",\n        },\n    ],\n    \"analytics\": {\"google_analytics_id\": \"G-L0C8PGT2LM\"},\n    \"pygment_light_style\": \"material\",\n    \"pygment_dark_style\": \"material\",\n    \"header_links_before_dropdown\": 5,\n    'secondary_sidebar_items': [\n        \"github-stars-button\",\n        \"panelitelink\",\n        \"page-toc\",\n    ],\n}\n\nextensions += [\n    'sphinx.ext.napoleon',\n    'nbsite.gallery',\n    'sphinx_copybutton',\n    'nbsite.pyodide'\n]\nnapoleon_numpy_docstring = True\n\nmyst_enable_extensions = [\"colon_fence\", \"deflist\"]\n\ngallery_endpoint = 'panel-gallery-dev' if is_dev else 'panel-gallery'\ngallery_url = f'https://{gallery_endpoint}.pyviz.demo.anaconda.com'\njlite_url = 'https://pyviz-dev.github.io/panelite-dev' if is_dev else 'https://panelite.holoviz.org'\npyodide_url = 'https://pyviz-dev.github.io/panel/pyodide' if is_dev else 'https://panel.holoviz.org/pyodide'\n\nnbsite_gallery_conf = {\n    'github_org': 'holoviz',\n    'github_project': 'panel',\n    'galleries': {\n        'reference': {\n            'title': 'Component Gallery',\n            'sections': [\n                'panes',\n                'layouts',\n                'templates',\n                'global',\n                'indicators',\n                'widgets',\n            ],\n            'titles': {\n                'Vega': 'Altair & Vega',\n                'DeckGL': 'PyDeck & Deck.gl',\n                'ECharts': 'PyEcharts & ECharts',\n                'IPyWidget': 'ipywidgets'\n            },\n            'as_pyodide': True,\n            'normalize_titles': False\n        }\n    },\n    'thumbnail_url': 'https://assets.holoviz.org/panel/thumbnails',\n    'deployment_url': gallery_url,\n    'jupyterlite_url': jlite_url,\n}\n\nif panel.__version__ != version and (PANEL_ROOT / 'dist' / 'wheels').is_dir():\n    py_version = panel.__version__.replace(\"-dirty\", \"\")\n    panel_req = f'./wheels/panel-{py_version}-py3-none-any.whl'\n    bokeh_req = f'./wheels/bokeh-{BOKEH_VERSION}-py3-none-any.whl'\nelse:\n    panel_req = f'{CDN_DIST}wheels/panel-{PY_VERSION}-py3-none-any.whl'\n    bokeh_req = f'{CDN_DIST}wheels/bokeh-{BOKEH_VERSION}-py3-none-any.whl'\n\ndef get_requirements():\n    with open('pyodide_dependencies.json') as deps:\n        dependencies = json.load(deps)\n    requirements = {}\n    for src, deps in dependencies.items():\n        if deps is None:\n            continue\n        src = src.replace('.ipynb', '').replace('.md', '')\n        for name, min_version in MINIMUM_VERSIONS.items():\n            if any(name in req for req in deps):\n                deps = [f'{name}>={min_version}' if name in req else req for req in deps]\n        requirements[src] = deps\n    return requirements\n\nnbsite_pyodide_conf = {\n    'PYODIDE_URL': 'https://cdn.jsdelivr.net/pyodide/v0.23.1/full/pyodide.js',\n    'requirements': [bokeh_req, panel_req, 'pyodide-http'],\n    'requires': get_requirements()\n}\n\ntemplates_path += [\n    '_templates'\n]\n\nhtml_context.update({\n    \"last_release\": f\"v{release}\",\n    \"github_user\": \"holoviz\",\n    \"github_repo\": \"panel\",\n    \"default_mode\": \"light\",\n    \"panelite_endpoint\": jlite_url,\n    \"gallery_url\": gallery_url,\n    \"pyodide_url\": pyodide_url\n})\n\nnbbuild_patterns_to_take_along = [\"simple.html\", \"*.json\", \"json_*\"]\n\n# Override the Sphinx default title that appends `documentation`\nhtml_title = f'{project} v{version}'\n\n\n# Patching GridItemCardDirective to be able to substitute the domain name\n# in the link option.\nfrom sphinx_design.cards import CardDirective\nfrom sphinx_design.grids import GridItemCardDirective\n\norig_grid_run = GridItemCardDirective.run\n\ndef patched_grid_run(self):\n    app = self.state.document.settings.env.app\n    existing_link = self.options.get('link')\n    domain = getattr(app.config, 'grid_item_link_domain', None)\n    if self.has_content:\n        self.content.replace('|gallery-endpoint|', domain)\n    if existing_link and domain:\n        new_link = existing_link.replace('|gallery-endpoint|', domain)\n        self.options['link'] = new_link\n    return list(orig_grid_run(self))\n\nGridItemCardDirective.run = patched_grid_run\n\norig_card_run = CardDirective.run\n\ndef patched_card_run(self):\n    app = self.state.document.settings.env.app\n    existing_link = self.options.get('link')\n    domain = getattr(app.config, 'grid_item_link_domain', None)\n    if existing_link and domain:\n        new_link = existing_link.replace('|gallery-endpoint|', domain)\n        self.options['link'] = new_link\n    return orig_card_run(self)\n\nCardDirective.run = patched_card_run\n\ndef update_versions(app, docname, source):\n    # Inspired by: https://stackoverflow.com/questions/8821511\n    version_replace = {\n       \"{{PANEL_VERSION}}\" : PY_VERSION,\n       \"{{BOKEH_VERSION}}\" : BOKEH_VERSION,\n       \"{{PYSCRIPT_VERSION}}\" : \"2022.12.1\",\n       \"{{PYODIDE_VERSION}}\" : \"0.23.4\",\n    }\n\n    for old, new in version_replace.items():\n        source[0] = source[0].replace(old, new)\n\n\ndef setup(app) -> None:\n    try:\n        from nbsite.paramdoc import param_formatter, param_skip\n        app.connect('autodoc-process-docstring', param_formatter)\n        app.connect('autodoc-skip-member', param_skip)\n    except ImportError:\n        print('no param_formatter (no param?)')\n\n    app.connect('source-read', update_versions)\n    nbbuild.setup(app)\n    app.add_config_value('grid_item_link_domain', '', 'html')\n\ngrid_item_link_domain = gallery_endpoint\n", "path": "doc/conf.py"}]}