deephaven.ui
A reactive UI framework for building real-time data-focused web apps with Python. Handles high-volume, continuous data streams efficiently.
Turn real-time data into apps and dashboards quickly
Deephaven simplifies building UIs with real-time data by managing data streaming and wiring reactive data to individual UI components.
With deephaven.ui you can transform Kafka feeds, event streams, and data lakes into live BI dashboards and data apps. The framework provides reactive hooks and a library of pre-built, real-time data-ready UI components.
Example use cases
- Live market trading apps
- Real-time data analytics
- Interactive dashboards
- Data exploration tools
When to use this
When not to use this
- Your data updates slowly or never.
- Your dashboard is non-interactive.
- Your users need mobile or touch support.
deephaven.ui
Declare components as a function and assign to variables to display components. Use hooks to manage state and data updates.
Modeled after React, deephaven.ui provides a hook-based approach to state management. It lets you build sophisticated browser UIs in Python using ready-to-use inputs, lists, dropdowns, sliders, and more. Real-time data grids and plots update automatically with no extra effort. These UI components seamlessly handle reactive data and synchronize state back to your Python script.
Example
from deephaven import ui
@ui.component
def ui_counter():
count, set_count = ui.use_state(0)
return [
ui.text(f"You pressed {count} times"),
ui.button("Click me", on_press=lambda: set_count(count + 1)),
]
my_counter = ui_counter()
In this example, we create a counter component that counts how many times a button has been clicked and displays that value. The ui.use_state hook declares a count state variable that is synced with the server, and pressing the ui.button increments it.
Comparisons
Streamlit, Reflex, Dash, and Shiny are all great frameworks, but they each present challenges when working with real-time data. We tried to internalize the best ideas from each and engineered deephaven.ui to support real-time data capabilities across the entire stack.
| Best for | |
|---|---|
| deephaven.ui | Real-time data apps and dashboards |
| Streamlit | Rapid prototyping |
| Reflex dev | Full stack web apps |
| Plotly Dash | Refreshing dashboards |
| Python Shiny | Data science apps |
Getting data into these frameworks can be challenging, especially when working with real-time streams. Most frameworks are built for static data or infrequent updates. They often require custom code to manage live data. That extra work can quickly become complex and time-consuming.
Technical details
Building web UIs with real-time data in Python introduces complexities that static data applications do not face. We believe real-time data apps fundamentally require three core capabilities:
- Real-time data querying: A method to query real-time data and materialize views.
- Efficient data transport: A socket capable of efficiently handling continuous changes in data and application state.
- Reactive UI framework: A framework for UI components that re-render when their underlying state changes and provides browser-compatible components.
Real-Time Data Query Engine
First, the Deephaven query engine lets you query, aggregate, group, filter, join, and analyze real-time data feeds per user. It operates at a delta level to minimize wasteful re-computation and reduce memory usage.
Efficient Data Transport
Second, Deephaven manages a gRPC protobuf socket on your behalf that sends only the changed data and state. Tracking deltas minimizes data sent over the wire and can handle fast-changing data volumes that would otherwise overwhelm most clients. Deephaven automatically buffers, handles viewports, and throttles data to keep your UIs up-to-date and responsive.
Reactive UI with deephaven.ui
Finally, the deephaven.ui framework allows you to build interfaces with a reactive component model. Its UI components draw inspiration from React, following a straightforward, hook-based approach to state management, and are entirely composable. To simplify starting interface development, deephaven.ui provides a comprehensive library of pre-built, real-time data-compatible components. You can write Python to create sophisticated browser UIs with ready-to-use inputs, lists, dropdowns, sliders, and more. These UI components seamlessly handle reactive data and synchronize state back to your Python script.
Advanced Components for Live Data
This includes a powerful, live-updating data grid that uses intelligent viewporting to display data of virtually any scale, effectively handling billions of rows. Additionally, deephaven.ui features a customized version of Plotly Express. This version automatically updates when data changes and efficiently downsamples data based on screen resolution, enabling effortless plotting of large, live time-series datasets.