Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Visualization Frameworks Integration

Batuta provides ecosystem visualization for Python data visualization and ML demo frameworks, showing how they map to sovereign Rust replacements. The batuta viz command displays framework hierarchies and PAIML replacement mappings.

Core Principle

Python visualization frameworks are replaced by sovereign Rust alternatives. No Python runtime dependencies are permitted in the PAIML stack. Python code is transpiled to Rust via Depyler.

Framework Replacement Matrix

Python FrameworkPAIML ReplacementMigration Path
GradioPresentarDepyler transpilation
StreamlitPresentarDepyler transpilation
PanelTrueno-VizDepyler transpilation
DashPresentar + Trueno-VizDepyler transpilation
MatplotlibTrueno-VizDirect API mapping
PlotlyTrueno-VizDirect API mapping

Toyota Way Principles

PrincipleApplication
Genchi GenbutsuDirect visualization enables first-hand observation
Poka-YokePython interpreter eliminated from production
HeijunkaFrame-rate limiting prevents GPU saturation
JidokaExplicit component trees for predictable rendering
MudaSignal-based rendering eliminates wasted computation
KanbanVisual data flow with explicit signal graphs

CLI Usage

View All Frameworks

batuta viz tree

Output:

VISUALIZATION FRAMEWORKS ECOSYSTEM
==================================

GRADIO (Python) → Presentar (Rust)
├── Interface
│   └── Interface → Presentar::QuickApp
├── Blocks
│   └── Blocks → Presentar::Layout
├── Components
│   ├── Image → Trueno-Viz::ImageView
│   ├── Audio → Presentar::AudioPlayer
│   ├── Chatbot → Realizar + Presentar
│   └── DataFrame → Trueno-Viz::DataGrid
└── Deployment
    └── HuggingFace Spaces → Batuta deploy

STREAMLIT (Python) → Presentar (Rust)
├── Widgets
│   ├── Input → Presentar::Widgets
│   └── Display → Presentar + Trueno-Viz
├── Caching
│   ├── @st.cache_data → Trueno::TensorCache
│   └── session_state → Presentar::State
└── Deployment
    └── Streamlit Cloud → Batuta deploy
...

Filter by Framework

batuta viz tree --framework gradio
batuta viz tree --framework streamlit
batuta viz tree --framework panel
batuta viz tree --framework dash

View PAIML Replacement Mappings

batuta viz tree --integration

Output:

PAIML REPLACEMENTS FOR PYTHON VIZ
=================================

UI FRAMEWORKS
├── [REP] Presentar::QuickApp ← gr.Interface
├── [REP] Presentar::Layout ← gr.Blocks
├── [REP] Presentar::App ← dash.Dash
├── [REP] Presentar::Layout ← st.columns/sidebar

VISUALIZATION
├── [REP] Trueno-Viz::Chart ← dcc.Graph
├── [REP] Trueno-Viz::Chart ← st.plotly_chart
├── [REP] Trueno-Viz::DataGrid ← st.dataframe
├── [REP] Trueno-Viz::GPURaster ← datashader

COMPONENTS
├── [REP] Presentar::TextInput ← st.text_input
├── [REP] Presentar::Slider ← st.slider
├── [REP] Trueno-Viz::ImageView ← gr.Image

STATE & CACHING
├── [REP] Presentar::State ← st.session_state
├── [REP] Trueno::TensorCache ← @st.cache_data
├── [REP] Presentar::on_event ← @callback

DEPLOYMENT
├── [REP] Batuta deploy ← HuggingFace Spaces
├── [REP] Batuta deploy ← Streamlit Cloud
├── [REP] Batuta deploy ← Dash Enterprise

Legend: [REP]=Replaces (Python eliminated)

Summary: 21 Python components replaced by sovereign Rust alternatives
         Zero Python dependencies in production

JSON Output

batuta viz tree --format json
batuta viz tree --framework streamlit --format json
batuta viz tree --integration --format json

Why Replace Python Frameworks?

Gradio → Presentar

Problems with Gradio:

  • Python server restarts on every interaction
  • ~2s cold start time
  • ~100ms interaction latency
  • No offline capability

Presentar Benefits:

  • Persistent state with sub-millisecond updates
  • ~50ms cold start
  • ~16ms interaction latency (60fps)
  • WebAssembly deployment for edge/offline

Streamlit → Presentar

Problems with Streamlit:

  • Full script reruns on each interaction (Muda)
  • ~3s cold start, ~200ms latency
  • ~8MB bundle size
  • ~200MB memory usage

Presentar Benefits:

  • Signal-based reactivity (minimal DOM updates)
  • Compile-time type checking
  • ~500KB bundle size
  • ~20MB memory usage

Panel → Trueno-Viz

Problems with Panel:

  • 6+ HoloViz dependencies (Panel, HoloViews, Datashader, Bokeh, Param, Colorcet)
  • WebGL rendering (older API)
  • Python GIL contention

Trueno-Viz Benefits:

  • Single unified library
  • Native WebGPU rendering
  • Rust memory safety for big data
  • Billion-point rendering capability

Dash → Presentar + Trueno-Viz

Problems with Dash:

  • Callback spaghetti (invisible data dependencies)
  • Large Plotly.js bundle
  • WebGL performance limits

Presentar + Trueno-Viz Benefits:

  • Explicit signal graph (debuggable)
  • Smaller WASM bundle
  • WebGPU for maximum performance

Performance Comparison

MetricGradioStreamlitDashPresentar
Cold start~2s~3s~1s~50ms
Interaction~100ms~200ms~80ms~16ms
Bundle size~5MB~8MB~3MB~500KB
Memory~150MB~200MB~100MB~20MB
GPUNoNoWebGLWebGPU
OfflineNoNoNoYes
WASMNoNoNoYes

Component Mapping Reference

Gradio Components

GradioPresentar/Trueno-Viz
gr.InterfacePresentar::QuickApp
gr.BlocksPresentar::Layout
gr.ImageTrueno-Viz::ImageView
gr.AudioPresentar::AudioPlayer
gr.ChatbotRealizar + Presentar
gr.DataFrameTrueno-Viz::DataGrid

Streamlit Components

StreamlitPresentar/Trueno-Viz
st.writePresentar::Text
st.dataframeTrueno-Viz::DataGrid
st.plotly_chartTrueno-Viz::Chart
st.text_inputPresentar::TextInput
st.sliderPresentar::Slider
st.selectboxPresentar::Select
st.session_statePresentar::State
@st.cache_dataTrueno::TensorCache

Dash Components

DashPresentar/Trueno-Viz
dash.DashPresentar::App
dcc.GraphTrueno-Viz::Chart
dcc.InputPresentar::TextInput
dash_tableTrueno-Viz::DataGrid
@callbackPresentar::on_event

See Also