Path: blob/main/binder/jupyter-panel-apps-server/jupyter_panel_apps_server.py
2012 views
"""1Function to configure serving the panel example apps via jupyter-server-proxy.2"""3import pathlib45from glob import glob67ICON_PATH = str((pathlib.Path(__file__).parent / "examples-icon.svg").absolute())89DONT_SERVE = [10"examples/gallery/demos/attractors.ipynb",11"examples/gallery/demos/gapminders.ipynb",12"examples/gallery/demos/glaciers.ipynb",13"examples/gallery/demos/nyc_taxi.ipynb",14"examples/gallery/demos/portfolio-optimizer.ipynb",15]161718def get_apps():19return [20app21for app in glob("examples/gallery/**/*.ipynb", recursive=True)22if app not in DONT_SERVE23]242526def panel_serve_examples():27"""Returns the jupyter-server-proxy configuration for serving the example notebooks as Panel28apps.2930Returns:31Dict: The configuration dictionary32"""33apps = get_apps()34# See:35# https://jupyter-server-proxy.readthedocs.io/en/latest/server-process.html36# https://github.com/holoviz/jupyter-panel-proxy/blob/main/panel_server/__init__.py37return {38"command": [39"panel",40"serve",41*apps,42"--allow-websocket-origin=*",43"--port",44"{port}",45"--prefix",46"{base_url}panel",47],48"absolute_url": True,49"timeout": 360,50"launcher_entry": {51"enabled": True,52"title": "Apps",53"icon_path": ICON_PATH,54},55}565758