Minimal example; ```py import threading import numpy as np import polars as pl import uvicorn import streamlit as st from flexviz import Figure, app, register_source from flexviz.spec import encode_spec HOST, PORT = "127.0.0.1", 8000 @st.cache_resource # runs once, not on every rerun def start_flexviz(): n = 10_000_000 df = pl.DataFrame({"t": np.arange(n), "value": np.cumsum(np.random.randn(n))}) register_source("logs", df) # swap for pl.scan_parquet("logs.parquet") — stays lazy threading.Thread( target=uvicorn.run, args=(app,), kwargs={"host": HOST, "port": PORT, "log_level": "warning"}, daemon=True, ).start() start_flexviz() fig = Figure().add_line(x="t", y="value") # bound to the server-side "logs" source url = f"http://{HOST}:{PORT}/view?spec={encode_spec(fig.to_spec(source='logs'))}" st.iframe(url, height=600) ```
Activity