### Setup development environment Source: https://github.com/holoviz/panel/blob/main/doc/developer_guide/index.md Initializes the development environment, installs dependencies in editable mode, and sets up git hooks. ```bash pixi run setup-dev ``` -------------------------------- ### Example compilation output Source: https://github.com/holoviz/panel/blob/main/doc/how_to/custom_components/esm/build.md Sample console output showing successful npm installation and esbuild bundling process. ```text Running command: npm install npm output: added 1 package, and audited 2 packages in 649ms 1 package is looking for funding run `npm fund` for details found 0 vulnerabilities Running command: esbuild /var/folders/7c/ww31pmxj2j18w_mn_qy52gdh0000gq/T/tmp9yhyqo55/index.js --bundle --format=esm --outfile=/ConfettiButton.bundle.js --minify esbuild output: ...../ConfettiButton.bundle.js 10.5kb ⚡ Done in 9ms ``` -------------------------------- ### Install Panel dependencies Source: https://github.com/holoviz/panel/blob/main/doc/tutorials/expert/custom_anywidget_components.md Install the necessary packages to run the tutorial. ```sh pip install panel watchfiles ``` -------------------------------- ### Install Dependencies Source: https://github.com/holoviz/panel/blob/main/doc/tutorials/basic/build_crossfilter_dashboard.md Install HoloViews and Panel to build the dashboard. These are the core libraries required for this tutorial. ```bash holoviews panel ``` -------------------------------- ### Serve documentation Source: https://github.com/holoviz/panel/blob/main/doc/developer_guide/index.md Starts a pyodide server to allow interactive execution of documentation cells. ```bash pixi run docs-server ``` -------------------------------- ### Install Dependencies Source: https://github.com/holoviz/panel/blob/main/doc/how_to/desktop_or_mobile/pywebview.md Install the required packages for Panel, pywebview, and PyInstaller. ```bash pip install panel pywebview pyinstaller ``` -------------------------------- ### Run example tests Source: https://github.com/holoviz/panel/blob/main/doc/developer_guide/index.md Executes all example notebooks using nbval to ensure they run without errors. ```bash pixi run test-example ``` -------------------------------- ### Initialize and Start ServerVideoStream Source: https://github.com/holoviz/panel/blob/main/doc/tutorials/intermediate/build_server_video_stream.md Instantiate and start the ServerVideoStream to make the camera feed available. This should be done once to ensure sharing across sessions. ```python server_video_stream = ServerVideoStream() server_video_stream.start() ``` -------------------------------- ### Initialize Panel Extension Source: https://github.com/holoviz/panel/blob/main/examples/reference/chat/ChatStep.ipynb Required setup to initialize the Panel environment. ```python import time import panel as pn pn.extension() ``` -------------------------------- ### Install Panel dependencies Source: https://github.com/holoviz/panel/blob/main/doc/tutorials/basic/index.md Install the necessary libraries for the basic tutorials using either pip or conda. ```bash pip install altair hvplot matplotlib numpy pandas panel plotly scipy watchfiles ``` ```bash conda install -y -c conda-forge altair hvplot matplotlib numpy pandas panel plotly scipy watchfiles ``` -------------------------------- ### Install Panel via Package Managers Source: https://github.com/holoviz/panel/blob/main/doc/getting_started/installation.md Commands to install Panel and the recommended watchfiles dependency for development environments. ```bash pip install panel watchfiles ``` ```bash conda install panel watchfiles ``` -------------------------------- ### Install Dependencies Source: https://github.com/holoviz/panel/blob/main/doc/tutorials/basic/build_animation.md Required packages for running the animation tutorial. ```bash altair panel ``` -------------------------------- ### Streamlit Hello World Example Source: https://github.com/holoviz/panel/blob/main/doc/how_to/streamlit_migration/get_started.md Original Streamlit implementation using st.write. ```python import streamlit as st st.write("Hello World") ``` -------------------------------- ### Install dependencies with concurrency limits Source: https://github.com/holoviz/panel/blob/main/doc/developer_guide/index.md Use this command if standard installation fails due to network or solver issues. ```bash pixi install --concurrent-solves 4 --concurrent-downloads 4 ``` -------------------------------- ### Example Log Output Source: https://github.com/holoviz/panel/blob/main/doc/how_to/logging/index.md This is an example of the expected output when running a Panel application with the configured loggers. It shows the Bokeh server startup messages and the custom-formatted log entries from Panel, Bokeh, and the application itself. ```bash $ panel serve app.py 2024-03-16 08:26:59,183 Starting Bokeh server version 3.4.0 (running on Tornado 6.4) 2024-03-16 08:26:59,183 User authentication hooks NOT provided (default user enabled) 2024-03-16 08:26:59,199 Bokeh app running at: http://localhost:5006/app 2024-03-16 08:26:59,199 Starting Bokeh server with process id: 11200 2024-03-16 08:27:00,434 | INFO | app | logger successfully configured 2024-03-16 08:27:00,435 | INFO | bokeh | logger successfully configured 2024-03-16 08:27:00,437 | INFO | panel | logger successfully configured 2024-03-16 08:27:00,437 | INFO | app | Hello World 2024-03-16 08:27:00,585 | INFO | panel.io.server | Session 2863386286800 created ``` -------------------------------- ### Panel Hello World Example Source: https://github.com/holoviz/panel/blob/main/doc/how_to/streamlit_migration/get_started.md Panel implementation using pn.extension and .servable() for deployment. ```python import panel as pn pn.extension(sizing_mode="stretch_width", template="bootstrap") pn.panel("Hello World").servable() ``` -------------------------------- ### Accessing the Custom Sum Endpoint Source: https://github.com/holoviz/panel/blob/main/doc/how_to/server/endpoints.md After starting the Panel server with the custom plugin, you can access the '/sum' endpoint via HTTP. This example shows how to use 'curl' to send GET requests with query parameters and receive the summed result. ```bash curl http://localhost:5006/sum?a=1&b=3&c=39 ``` -------------------------------- ### Setup Playwright Browsers Source: https://github.com/holoviz/panel/blob/main/doc/how_to/test/loadtests.md Ensures that Playwright has the necessary browser binaries installed for testing. ```bash playwright install ``` -------------------------------- ### Initialize Panel and Param Source: https://github.com/holoviz/panel/blob/main/doc/explanation/dependencies/param.md Setup the environment by importing necessary libraries and initializing the Panel extension. ```python import param import panel as pn pn.extension() ``` -------------------------------- ### Initialize Panel Application Source: https://github.com/holoviz/panel/blob/main/doc/tutorials/intermediate/build_server_video_stream.md Entry point script to serve the video stream component. ```python import panel as pn from server_video_stream import server_video_stream pn.extension() server_video_stream.servable() ``` -------------------------------- ### TimePicker with String Input and Bounds Source: https://github.com/holoviz/panel/blob/main/examples/reference/widgets/TimePicker.ipynb Example demonstrating how to use string inputs for the value, start, and end parameters of the TimePicker widget. ```APIDOC ## TimePicker with String Input and Bounds ### Description This example shows how to initialize the ``TimePicker`` widget using string representations for the time value, start, and end bounds. ### Method N/A (Widget initialization) ### Endpoint N/A (Widget initialization) ### Request Example ```python import panel as pn pn.extension() time_picker = pn.widgets.TimePicker(name='Time Picker', value="08:28", start='00:00', end='12:00') time_picker ``` ### Response N/A (Widget initialization) ``` -------------------------------- ### Register Session Creation Callback Source: https://github.com/holoviz/panel/blob/main/doc/how_to/callbacks/session.md Defines a global callback that executes when a new session is created. This must be registered before the server starts, such as in a --setup script. ```python def session_created(session_context: BokehSessionContext): print(f'Created a session running at the {session_context.request.uri} endpoint') pn.state.on_session_created(session_created) ``` -------------------------------- ### Serve a basic Panel application Source: https://github.com/holoviz/panel/blob/main/doc/explanation/components/components_overview.md A simple example showing how to serve multiple components using the default template. ```python import panel as pn pn.panel('# Title').servable() pn.panel('Some text').servable() pn.panel('More text').servable() ``` -------------------------------- ### Combine interact examples Source: https://github.com/holoviz/panel/blob/main/doc/how_to/interact/interact_basics.md This snippet combines the definition of a function, its interaction with auto-generated widgets, and the creation and interaction with an explicitly provided widget. It also includes the necessary Panel extension setup. ```python import panel as pn pn.extension() # for notebook def foo(a, b, c, d, e, f): return f'Arguments: {a, b, c, d, e, f}' pn.interact( foo, a=True, b=10, c=(-10, 10, 0.1, 5.4), d='text', e=['apples', 'oranges'], f=dict([('first', 10), ('second', 20)]) ) def create_block(c): return pn.pane.HTML(width=100, height=100, styles={'background': c}) color_widget = pn.widgets.ColorPicker(name='Color', value='#4f4fdf') pn.interact(create_block, c=color_widget) ``` -------------------------------- ### Cloud Run Dockerfile Configuration Source: https://github.com/holoviz/panel/blob/main/doc/how_to/deployment/gcp.md Dockerfile for building a container image to deploy a Panel app to Google Cloud Run. It sets up the Python environment, installs dependencies, and defines the command to start the Panel server. ```dockerfile # Use the official lightweight Python image. # https://hub.docker.com/_/python FROM python:3.10-slim # Allow statements and log messages to immediately appear in the Knative logs ENV PYTHONUNBUFFERED True # Copy local code to the container image. ENV APP_HOME /app WORKDIR $APP_HOME COPY . ./ # Install production dependencies. RUN pip install --no-cache-dir -r requirements.txt # Run the web service on container startup. CMD panel serve app.py --address 0.0.0.0 --port 8080 --allow-websocket-origin="*" ``` -------------------------------- ### Start the Panel server Source: https://github.com/holoviz/panel/blob/main/README.md Use the command line to serve either a Python script or a Jupyter notebook. ```bash panel serve name_of_script.py --show ``` ```bash panel serve name_of_notebook.ipynb --show ``` -------------------------------- ### Example Task Runner and Button Source: https://github.com/holoviz/panel/blob/main/doc/how_to/concurrency/manual_threading.md Demonstrates how to instantiate the `SessionTaskRunner` with a worker function and create a button to add tasks to its queue. This setup allows users to trigger background processing via a simple UI interaction, keeping the application responsive. ```python def example_worker(task): time.sleep(1) return datetime.datetime.now() task_runner = SessionTaskRunner(worker=example_worker) def add_task(event): task_runner.append("task") button = pn.widgets.Button(name="Add Task", on_click=add_task, button_type="primary") pn.Column(button, task_runner).servable() ``` -------------------------------- ### Install Testing Dependencies Source: https://github.com/holoviz/panel/blob/main/doc/how_to/test/uitests.md Installs Panel, Pytest, and Playwright. Ensure Playwright browsers are set up using 'playwright install'. ```bash pip install panel pytest pytest-playwright ``` ```bash playwright install ``` -------------------------------- ### Install Dependencies Source: https://github.com/holoviz/panel/blob/main/doc/tutorials/intermediate/build_server_video_stream.md Commands to install required packages for the application. ```bash conda install -y -c conda-forge opencv panel pillow watchfiles ``` ```bash pip install opencv-python panel pillow watchfiles ``` -------------------------------- ### Initialize Panel Extension Source: https://github.com/holoviz/panel/blob/main/doc/how_to/param/examples/precedence.md Sets up the Panel environment with a bootstrap template. ```python import panel as pn import param pn.extension(template='bootstrap') ``` -------------------------------- ### Install Dependencies Source: https://github.com/holoviz/panel/blob/main/doc/tutorials/basic/build_dashboard.md Commands to install the required libraries for the dashboard. ```bash pip install hvplot pandas panel ``` ```bash conda install -y -c conda-forge hvplot pandas panel ``` -------------------------------- ### Panel Server Startup Log Source: https://github.com/holoviz/panel/blob/main/doc/tutorials/basic/serve.md Example output from the Panel server upon successful startup, indicating the Bokeh server version and the URL where the app is accessible. ```bash 2024-01-17 21:05:32,338 Starting Bokeh server version 3.3.3 (running on Tornado 6.4) 2024-01-17 21:05:32,339 User authentication hooks NOT provided (default user enabled) 2024-01-17 21:05:32,342 Bokeh app running at: http://localhost:5006/app 2024-01-17 21:05:32,342 Starting Bokeh server with process id: 42008 ``` -------------------------------- ### View CLI help and options Source: https://github.com/holoviz/panel/blob/main/doc/how_to/server/commandline.md Display the full list of available arguments and options for the panel serve command. ```bash positional arguments: DIRECTORY-OR-SCRIPT The app directories or scripts to serve (serve empty document if not specified) options: -h, --help show this help message and exit --port PORT Port to listen on --address ADDRESS Address to listen on --unix-socket UNIX-SOCKET Unix socket to bind. Network options such as port, address, ssl options are incompatible with unix socket --log-level LOG-LEVEL One of: trace, debug, info, warning, error or critical --log-format LOG-FORMAT A standard Python logging format string (default: '%(asctime)s %(message)s') --log-file LOG-FILE A filename to write logs to, or None to write to the standard stream (default: None) --use-config CONFIG Use a YAML config file for settings --args ... Command line arguments remaining to passed on to the application handler. NOTE: if this argument precedes DIRECTORY-OR-SCRIPT then some other argument, e.g. --show, must be placed before the directory or script. --dev [FILES-TO-WATCH ...] Enable live reloading during app development. By default it watches all *.py *.html *.css *.yaml files in the app directory tree. Additional files can be passed as arguments. NOTE: if this argument precedes DIRECTORY-OR-SCRIPT then some other argument, e.g --show, must be placed before the directory or script. NOTE: This setting only works with a single app. It also restricts the number of processes to 1. NOTE FOR WINDOWS USERS : this option must be invoked using 'python -m bokeh'. If not Tornado will fail to restart the server --show Open server app(s) in a browser --allow-websocket-origin HOST[:PORT] Public hostnames which may connect to the Bokeh websocket With unix socket, the websocket origin restrictions should be enforced by the proxy. --prefix PREFIX URL prefix for Bokeh server URLs --ico-path ICO_PATH Path to a .ico file to use as the favicon.ico, or 'none' to disable favicon.ico support. If unset, a default Bokeh .ico file will be used --keep-alive MILLISECONDS How often to send a keep-alive ping to clients, 0 to disable. --check-unused-sessions MILLISECONDS How often to check for unused sessions --unused-session-lifetime MILLISECONDS How long unused sessions last --stats-log-frequency MILLISECONDS How often to log stats --mem-log-frequency MILLISECONDS How often to log memory usage information --use-xheaders Prefer X-headers for IP/protocol information --ssl-certfile CERTFILE Absolute path to a certificate file for SSL termination --ssl-keyfile KEYFILE Absolute path to a private key file for SSL termination --session-ids MODE One of: unsigned, signed or external-signed --auth-module AUTH_MODULE Absolute path to a Python module that implements auth hooks --enable-xsrf-cookies Whether to enable Tornado support for XSRF cookies. All PUT, POST, or DELETE handlers must be properly instrumented when this setting is enabled. --exclude-headers EXCLUDE_HEADERS [EXCLUDE_HEADERS ...] A list of request headers to exclude from the session context (by default all headers are included). --exclude-cookies EXCLUDE_COOKIES [EXCLUDE_COOKIES ...] A list of request cookies to exclude from the session context (by default all cookies are included). --include-headers INCLUDE_HEADERS [INCLUDE_HEADERS ...] A list of request headers to make available in the session context (by default all headers are included). ``` -------------------------------- ### Initialize Thread and Start Camera Stream Source: https://github.com/holoviz/panel/blob/main/doc/tutorials/intermediate/build_server_video_stream.md Initializes the class with a thread for image capture and starts the stream. The start method activates cameras and begins the capture thread. ```python def __init__(self, **params): super().__init__(**params) self._cameras = {} self._stop_thread = False self._thread = threading.Thread(target=self._take_images) self._thread.daemon = True def start(self, camera_indices): if camera_indices: for index in camera_indices: self.get_camera(index) if not self._thread.is_alive(): self._thread.start() ``` -------------------------------- ### Initialize Panel and Imports Source: https://github.com/holoviz/panel/blob/main/doc/tutorials/basic/build_animation.md Import necessary libraries and initialize the Panel Vega extension. ```python import altair as alt import pandas as pd import panel as pn pn.extension("vega") ``` -------------------------------- ### Initialize Panel Extension and Create DataStore with Views Source: https://github.com/holoviz/panel/blob/main/doc/tutorials/intermediate/structure_data_store.md Initializes the Panel extension with 'tabulator' and 'vega' and sets up a DataStore with turbines data. It then displays the DataStore alongside Panel Tabs containing Indicators, Histogram, and Table views. ```python import panel as pn pn.extension("tabulator", "vega", throttled=True) turbines = get_turbines() ds = DataStore(data=turbines, filters=['p_year', 'p_cap', 't_manu']) pn.Row( ds, pn.Tabs( ('Indicators', Indicators(data_store=ds)), ('Histogram', Histogram(data_store=ds)), ('Table', Table(data_store=ds)), sizing_mode='stretch_width', ) ).servable() ``` -------------------------------- ### Install Dependencies via CLI Source: https://github.com/holoviz/panel/blob/main/doc/tutorials/basic/build_animation.md Installation commands for pip and conda environments. ```bash pip install altair panel ``` ```bash conda install -y -c conda-forge altair panel ``` -------------------------------- ### Initialize Panel Models Source: https://github.com/holoviz/panel/blob/main/doc/how_to/links/watchers.md Sets up the Markdown panes and ToggleGroup widget required for the demonstration. ```python import panel as pn pn.extension() selections = pn.pane.Markdown(object='') selected = pn.pane.Markdown(object='') toggle = pn.widgets.ToggleGroup(options=['A', 'B']) ``` -------------------------------- ### Install testing dependencies Source: https://github.com/holoviz/panel/blob/main/doc/how_to/test/pytest.md Install the necessary packages for testing Panel applications. ```bash pip install panel pytest pytest-benchmark ``` -------------------------------- ### Install pyviz_comms extension Source: https://github.com/holoviz/panel/blob/main/doc/how_to/wasm/jupyterlite.md Install the required communication extension in your build environment. ```bash pip install pyviz_comms ``` -------------------------------- ### Initialize Panel with Vega Extension Source: https://github.com/holoviz/panel/blob/main/doc/how_to/links/examples/vega_link.md Import Panel and enable the 'vega' extension. A template like 'bootstrap' can be optionally applied. ```python import panel as pn pn.extension('vega', template='bootstrap') ``` -------------------------------- ### Install Dependencies with Pip Source: https://github.com/holoviz/panel/blob/main/examples/apps/django/README.md Use this command to install project dependencies from a requirements file. ```bash pip install -r requirements.txt ``` -------------------------------- ### Install Dependencies with Conda Source: https://github.com/holoviz/panel/blob/main/examples/apps/django/README.md Use this command to install Panel and its Django-related dependencies using Conda. ```bash conda install -c conda-forge bokeh-django django==5 django-channels panel ``` -------------------------------- ### Initialize Panel Environment Source: https://github.com/holoviz/panel/blob/main/examples/gallery/iris_kmeans.ipynb Sets up the Panel extension with the Material design template. ```python import numpy as np import pandas as pd import panel as pn import hvplot.pandas from sklearn.cluster import KMeans from bokeh.sampledata import iris pn.extension(design='material', template='material') ``` -------------------------------- ### Install Panel dependencies Source: https://github.com/holoviz/panel/blob/main/doc/tutorials/basic/build_todo.md Commands to install the Panel library using different package managers. ```bash pip install panel ``` ```bash conda install -y -c conda-forge panel ``` -------------------------------- ### Initialize Panel and Serve Application Source: https://github.com/holoviz/panel/blob/main/doc/tutorials/intermediate/create_form.md Configure Panel extensions and make the created form servable. This code should be at the end of your application file. ```python pn.extension(notifications=True, design="bootstrap", sizing_mode="stretch_width") form = create_form() form.servable() ``` -------------------------------- ### Initialize Panel Environment Source: https://github.com/holoviz/panel/blob/main/examples/gallery/nyc_deckgl.ipynb Sets up the Panel extension with DeckGL and configures the bootstrap design and theme. ```python import panel as pn import pandas as pd import param pn.extension('deckgl', design='bootstrap', theme='dark', template='bootstrap') pn.state.template.config.raw_css.append(""" #main { padding: 0; }""") ``` -------------------------------- ### Verify esbuild installation Source: https://github.com/holoviz/panel/blob/main/doc/how_to/custom_components/esm/build.md Check the installed version of esbuild to confirm it is available in the system path. ```bash esbuild --version ``` -------------------------------- ### Install Ploomber Cloud CLI Source: https://github.com/holoviz/panel/blob/main/doc/how_to/deployment/ploomber.md Install the necessary package to interact with Ploomber Cloud from the terminal. ```bash pip install ploomber-cloud ``` -------------------------------- ### Initialize Panel and Altair Environment Source: https://github.com/holoviz/panel/blob/main/examples/gallery/altair_brushing.ipynb Sets up the Panel extension with Vega support and configures the template. ```python import altair as alt import pandas as pd import panel as pn pn.extension('vega', template='fast') pn.state.template.title = "Altair Brushing Example" ``` -------------------------------- ### Initialize Panel and ReactiveHTML Source: https://github.com/holoviz/panel/blob/main/doc/how_to/custom_components/examples/canvas_draw.md Setup the necessary imports and initialize the Panel extension with a template. ```python import param import panel as pn from panel.reactive import ReactiveHTML pn.extension(template='bootstrap') ``` -------------------------------- ### Install pamela library Source: https://github.com/holoviz/panel/blob/main/doc/how_to/authentication/pam.md Install the required pamela library using either pip or conda. ```bash pip install pamela ``` ```bash conda install -c conda-forge pamela ``` -------------------------------- ### Install Panel in editable mode Source: https://github.com/holoviz/panel/blob/main/doc/developer_guide/index.md Installs the package in editable mode for the current or a specified environment. ```bash pixi run install ``` ```bash pixi run -e test-ui install ``` -------------------------------- ### Initialize MaterialTemplate with widgets Source: https://github.com/holoviz/panel/blob/main/examples/reference/templates/Material.ipynb Demonstrates setting up a MaterialTemplate by passing widgets to the sidebar area. ```python import hvplot.pandas import numpy as np import panel as pn import pandas as pd xs = np.linspace(0, np.pi) freq = pn.widgets.FloatSlider(name="Frequency", start=0, end=10, value=2) phase = pn.widgets.FloatSlider(name="Phase", start=0, end=np.pi) def sine(freq, phase): return pd.DataFrame(dict(y=np.sin(xs*freq+phase)), index=xs) def cosine(freq, phase): return pd.DataFrame(dict(y=np.cos(xs*freq+phase)), index=xs) dfi_sine = hvplot.bind(sine, freq, phase).interactive() dfi_cosine = hvplot.bind(cosine, freq, phase).interactive() plot_opts = dict(responsive=True, min_height=400) # Instantiate the template with widgets displayed in the sidebar template = pn.template.MaterialTemplate( title='MaterialTemplate', sidebar=[freq, phase], ) ``` -------------------------------- ### Initialize FastAPI application Source: https://github.com/holoviz/panel/blob/main/doc/how_to/integrations/FastAPI.md Create a basic FastAPI application instance in main.py. ```python from fastapi import FastAPI # Initialize FastAPI application app = FastAPI() @app.get("/") async def read_root(): return {"Hello": "World"} ``` -------------------------------- ### Install Panel with Pip Source: https://github.com/holoviz/panel/blob/main/README.md Use this command to install Panel using the pip package manager. ```bash pip install panel ``` -------------------------------- ### Initialize Panel Environment Source: https://github.com/holoviz/panel/blob/main/examples/reference/widgets/DateRangeSlider.ipynb Required setup to initialize the Panel extension before using widgets. ```python import datetime as dt import panel as pn pn.extension() ``` -------------------------------- ### Install Panel and SciPy dependencies Source: https://github.com/holoviz/panel/blob/main/doc/tutorials/basic/build_streaming_dashboard.md Use these commands to install the necessary packages via conda or pip. ```bash conda install -y -c conda-forge panel scipy ``` ```bash pip install panel scipy ``` -------------------------------- ### Feed Initialization Examples Source: https://github.com/holoviz/panel/blob/main/examples/reference/layouts/Feed.ipynb Demonstrates different ways to initialize and configure the Feed component. ```APIDOC ### Example 1: Basic Feed Initialization ```python import panel as pn pn.extension() Feed = pn.Feed(*list(range(1000)), load_buffer=20) Feed ``` ### Example 2: Initialize at Latest Entry To have the Feeds immediately initialized at the latest entry, set `view_latest=True`. ```python import panel as pn pn.extension() Feed = pn.Feed(*list(range(1000)), view_latest=True) Feed ``` ### Example 3: Scroll Button Threshold Additionally, to allow users to scroll to the bottom interactively, set a `scroll_button_threshold` which will make the Feed display a clickable scroll button. ```python import panel as pn pn.extension() Feed = pn.Feed(*list(range(1000)), scroll_button_threshold=20, width=300) Feed ``` ``` -------------------------------- ### Install nbsite with Conda Source: https://github.com/holoviz/panel/blob/main/doc/how_to/wasm/sphinx.md Install the nbsite package using Conda. This is required for using the nbsite.pyodide directive. ```bash conda install -c pyviz nbsite ``` -------------------------------- ### Initialize Panel and Imports Source: https://github.com/holoviz/panel/blob/main/examples/gallery/penguin_kmeans.ipynb Sets up the Panel environment with required extensions and imports necessary libraries for data processing and clustering. ```python import altair as alt import panel as pn import pandas as pd from sklearn.cluster import KMeans pn.extension('tabulator', 'vega', design='material', template='material') ``` -------------------------------- ### Initialize Briefcase Project Source: https://github.com/holoviz/panel/blob/main/doc/how_to/desktop_or_mobile/toga.md Starts the interactive project creation process for a new Briefcase application. ```bash briefcase new ``` -------------------------------- ### Install nbsite with Pip Source: https://github.com/holoviz/panel/blob/main/doc/how_to/wasm/sphinx.md Install the nbsite package using pip. This is required for using the nbsite.pyodide directive. ```bash pip install nbsite ``` -------------------------------- ### Install Briefcase Source: https://github.com/holoviz/panel/blob/main/doc/how_to/desktop_or_mobile/toga.md Installs the Briefcase tool required for packaging Python projects into standalone native applications. ```bash pip install briefcase ``` -------------------------------- ### Initialize and populate a VanillaTemplate Source: https://github.com/holoviz/panel/blob/main/examples/reference/templates/Vanilla.ipynb Demonstrates setting up a VanillaTemplate with sidebar widgets and appending interactive plots to the main area. ```python import hvplot.pandas import numpy as np import panel as pn import pandas as pd xs = np.linspace(0, np.pi) freq = pn.widgets.FloatSlider(name="Frequency", start=0, end=10, value=2) phase = pn.widgets.FloatSlider(name="Phase", start=0, end=np.pi) def sine(freq, phase): return pd.DataFrame(dict(y=np.sin(xs*freq+phase)), index=xs) def cosine(freq, phase): return pd.DataFrame(dict(y=np.cos(xs*freq+phase)), index=xs) dfi_sine = hvplot.bind(sine, freq, phase).interactive() dfi_cosine = hvplot.bind(cosine, freq, phase).interactive() plot_opts = dict(responsive=True, min_height=400) # Instantiate the template with widgets displayed in the sidebar template = pn.template.VanillaTemplate( title='VanillaTemplate', sidebar=[freq, phase], ) # Append a layout to the main area, to demonstrate the list-like API template.main.append( pn.Row( pn.Card(dfi_sine.hvplot(**plot_opts).output(), title='Sine'), pn.Card(dfi_cosine.hvplot(**plot_opts).output(), title='Cosine'), ) ) template.servable(); ``` -------------------------------- ### Run Notification Demo Source: https://github.com/holoviz/panel/blob/main/examples/reference/global/Notifications.ipynb Launch a demonstration of the notification system. ```python pn.io.notifications.NotificationArea.demo() ``` -------------------------------- ### Install Panel FastAPI dependencies Source: https://github.com/holoviz/panel/blob/main/doc/how_to/integrations/FastAPI.md Install the necessary packages to enable native FastAPI support for Panel. ```bash pip install panel[fastapi] ``` ```bash conda install -c conda-forge bokeh-fastapi ``` -------------------------------- ### Install pythonanywhere CLI Source: https://github.com/holoviz/panel/blob/main/doc/how_to/deployment/pythonanywhere.md Installs or upgrades the pythonanywhere command-line tool. This is required to deploy a Panel app. ```bash pip install --upgrade pythonanywhere ``` -------------------------------- ### Initialize Panel Environment Source: https://github.com/holoviz/panel/blob/main/doc/how_to/links/examples/bokeh_property_editor.md Sets up the Panel environment with the Bootstrap template. ```python import numpy as np import panel as pn pn.extension(template='bootstrap') ``` -------------------------------- ### Install dependencies and bundle with esbuild Source: https://github.com/holoviz/panel/blob/main/doc/how_to/custom_components/esm/build.md Commands to install npm packages and generate the final bundle file. ```bash npm install ``` ```bash esbuild confetti.js --bundle --format=esm --minify --outfile=ConfettiButton.bundle.js ``` -------------------------------- ### Initialize Bokeh and Panel Environment Source: https://github.com/holoviz/panel/blob/main/doc/how_to/callbacks/examples/streaming_bokeh.md Sets up the necessary imports and configures the Panel extension with the Fast template. ```python import numpy as np import panel as pn from bokeh.plotting import figure from bokeh.models import ColumnDataSource pn.extension(template='fast') ``` -------------------------------- ### Install Panel, hvPlot, and Dask Source: https://github.com/holoviz/panel/blob/main/doc/how_to/concurrency/dask.md Install the necessary libraries for Panel, hvPlot, and Dask distributed computing. ```bash pip install panel hvplot dask[distributed] ``` -------------------------------- ### ColorMap Widget Usage Examples Source: https://github.com/holoviz/panel/blob/main/examples/reference/widgets/ColorMap.ipynb Examples demonstrating how to use the ColorMap widget with different color sources. ```APIDOC ### Usage Examples The `options` of a `ColorMap` must be a dictionary containing a list of colors specified as hex values, named colors or `rgba()` CSS color specifications. You may provide either the concrete colormap as the `value` or the name of the colormap in the dictionary using the `value_name`: ```python import panel as pn pn.extension() cmaps = { 'Reds': ['lightpink', 'red', 'darkred'], 'Blues': ['rgba(0, 0, 255, 1)', 'rgba(0, 0, 170, 1)', 'rgba(0, 0, 85, 1)'], 'Greens': ['#00ff00', '#00aa00', '#004400'] } color_map = pn.widgets.ColorMap(options=cmaps, value_name='Reds', width=200, margin=(0, 0, 100, 0)) color_map ``` When rendering many colormaps you can enable `ncols` and control the size of the color swatches using the `swatch_width` and `swatch_height` options: ```python import panel as pn import colorcet as cc pn.extension() pn.widgets.ColorMap(options=cc.palette, ncols=3, swatch_width=100, margin=(0, 0, 200, 0)) ``` The widget also supports matplotlib colormaps: ```python import panel as pn from matplotlib.cm import Reds, Blues, Greens pn.extension() pn.widgets.ColorMap(options={'Reds': Reds, 'Blues': Blues, 'Greens': Greens}, margin=(0, 0, 100, 0)) ``` ``` -------------------------------- ### Initialize VTK Extension Source: https://github.com/holoviz/panel/blob/main/examples/reference/panes/VTKVolume.ipynb Required setup to enable VTK functionality within a Panel application. ```python import panel as pn pn.extension('vtk') ``` -------------------------------- ### Install Panel Dependencies Source: https://github.com/holoviz/panel/blob/main/doc/tutorials/intermediate/index.md Install the necessary packages to run the intermediate tutorials using either pip or conda. ```bash pip install altair hvplot numpy pandas panel pytest watchfiles ``` ```bash conda install -y -c conda-forge altair hvplot numpy pandas panel pytest watchfiles ```