H2O Wave Documentation
website·Indexed 41 days ago
https://wave.h2o.ai/A software stack for building low-latency, realtime, browser-based applications and dashboards using Python. The documentation covers server configuration, ASGI program development, UI widgets (forms, stats, tabs), custom CSS and theming, file uploads, and WaveDB, a SQLite-based HTTP interface.
What's inside H2O Wave
- Data buffers are in-memory tabular data structures (containing columns and rows) designed to hold a card's data. They allow developers to separate data from presentation, meaning a card can be declared once and its underlying data buffer updated multiple times. A single card can hold zero or more data buffers.
Overview of H2O Wave
H2O Wave is a software stack used to build low-latency, real-time, browser-based applications and dashboards entirely in Python. It eliminates the need for HTML, JavaScript, or CSS by allowing developers to push content to connected clients in real-time. It is particularly suited for live monitoring dashboards, news tickers, instant notification apps, chat bots, and collaborative tools.Overview of the h2o_wave Python driver
Theh2o_wavePython package is a driver for H2O Wave, a lightweight software stack used to program interactive, low-latency, real-time, and collaborative web applications entirely in Python. It eliminates the need for HTML, JavaScript, or CSS by providing a suite of built-in form and data visualization components. The system relies on a Wave relay server to synchronize state between the Python backend and web browsers.Understand the H2O Wave programming model
H2O Wave follows a stateful server model where the Wave server retains content independently of the script that created it.
- Site: A collection of pages accessible by route keys.
- Page: A collection of cards. To change a page, you modify its cards and call
save(). - Card: A block of content (text, graphics, widgets). The
boxattribute defines its position and size on the grid. - Persistence: Because the server retains content, a script can exit, but the page remains visible to users until changed by another script or process.
H2O Wave Architecture Overview
H2O Wave is a software stack for building low-latency, real-time, browser-based applications and dashboards using only Python. It eliminates the need for HTML, JavaScript, or CSS by using a three-tier architecture:
- Wave Server: A static binary executable (~10MB) that acts as a content server, HTTP web server, and proxy. It stores site content, transmits changes to browsers, and relays browser events to apps.
- Language Driver: The
h2o-wavePyPI package used by Python scripts and apps to manage content on the server via an idiomatic Python API. - Browser-based Client: The user interface that renders content and transmits user actions (events) back to the server.
Start and configure the H2O Wave server
The H2O Wave server can be started in two ways: using the
wave runcommand (which automatically starts thewavedserver and is ideal for development) or by running thewavedserver binary directly (ideal for deployment or remote server hosting).Configuration settings are applied based on the following priority (highest to lowest):
- Command line arguments
- Environment variables
- Configuration files (e.g.,
.env) - Default settings
Render vector graphics using ui.graphics_card
Wave provides a graphics card component,ui.graphics_card(), to render SVG vector graphics backed by data buffers. The card uses two primary attributes to manage rendering performance:stagefor static background elements andscenefor elements that require animation or frequent updates.Start and configure the H2O Wave server
The H2O Wave server can be started in two ways depending on the environment: use the
wave runcommand for development (which starts thewavedserver automatically) or use thewavedserver binary directly for deployment or remote server setups.Configuration settings can be applied via command line arguments, environment variables, or a configuration file (e.g.,
.env). The priority order for these settings is: Command line arguments > Environment variables > Configuration file > Default values.Access H2O Wave technical documentation and API
For deep dives into the framework, use the following resources:
- Detailed Guides: Covers core concepts including Architecture, Wave Scripts, Apps, Pages, Layouts, Cards, Data Buffers, Components, Query Arguments, App State, Routing, Realtime Sync, Background Tasks, Data-binding, Files, Plots, Javascript, Graphics, Security, Logging, CLI, Development, Browser Testing, Configuration, Deployment, and Backup/Recovery.
- API Reference: Detailed documentation on all available functions, their parameters, and outputs.
- Change Log: An ordered list of new features and updates.
Download Wave examples and binaries using wave fetch
Usewave fetchto download example applications and thewavedserver binary into a local./wavefolder. You can optionally specify the target platform and architecture.# Download examples and waved wave fetch # Download for a specific platform and architecture wave fetch --platform linux --arch amd64Display status and informational messages using ui.message_bar
The
ui.message_barcomponent is used to notify users about application states, such as success, failure, warnings, or general information. The component supports plaintext, markdown, and HTML for the message text.Available
typeoptions include:blocked: Indicates an action is blocked.error: Indicates an error occurred.warning: Indicates a warning.info: Provides general information.success: Indicates a successful operation.danger: Indicates a critical danger state.
q.page['form'] = ui.form_card( box='1 1 4 7', items=[ ui.message_bar(type='blocked', text='This action is blocked.'), ui.message_bar(type='error', text='This is an error message'), ui.message_bar(type='warning', text='This is a warning message.'), ui.message_bar(type='info', text='This is an information message.'), ui.message_bar(type='success', text='This is an success message.'), ui.message_bar(type='danger', text='This is a danger message.'), ui.message_bar(type='success', text='This is a **MARKDOWN** _message_.'), ui.message_bar(type='success', text='This is an <b>HTML</b> <i>message</i>.'), ] )WaveDB architecture and client compatibility
WaveDB is built with Go and based on SQLite. Because it provides an HTTP and JSON interface, it can be used from any language or platform with HTTP/JSON libraries. The official Python client is implemented using HTTPX.