⚡ PyDataUI
The Full-Stack Python Framework: Streamlit Simplicity on the Surface, Next.js Performance Underneath.
Data Scientists • AI Engineers • Backend Developers • Full-Stack Pythonistas
🌐 Documentation Website • 📖 Developer Cookbook (PDF) • 10s Quickstart • Next.js Full-Stack SaaS • 20 Visual Themes • FastAPI Mounting
💡 Why PyDataUI?
In modern web development, developers are forced to choose between two painful trade-offs:
- Streamlit: Great 10-second prototyping DX, but re-executes lines 1–100 on every user click, leading to laggy UIs, session bugs, and zero built-in REST API capabilities.
- Next.js + FastAPI: Exceptional performance, but requires maintaining two languages (TypeScript + Python), 450 MB of
node_modules, separate deployments, and constant API schema glue code.
PyDataUI eliminates this trade-off completely:
- 10-Second Procedural Simplicity: Write
pdu.write(df),with pdu.sidebar():, andpdu.columns([1, 2])just like Streamlit. - Zero Full-Script Re-runs: Powered by server-side HTMX DOM morphing — only the affected UI fragment updates.
- 0ms In-Memory Model Access: Your UI and your AI models (PyTorch, LangChain, Ollama, Pandas) share the exact same process memory.
- Native FastAPI Engine: Every state action can automatically expose an OpenAPI 3.1 REST route with interactive Swagger UI at
/docs. - 20 Curated Themes + Custom Palettes: Gorgeous out-of-the-box Shadcn/Tailwind design with seamless dark mode.
- One-Command Public Tunnel: Run with
share=Trueand get a secure public HTTPS demo link in 3.5 seconds.
🎨 Visual Theme Showcase: One-Line Enterprise Aesthetics
Forget the rigid or dated look of traditional prototyping tools. PyDataUI gives you production-grade Shadcn & Tailwind aesthetics on day one. Switch between themes in 1 line of Python:
| Theme Preset | Ideal For | Activate with 1 Line |
|---|---|---|
Violet (theme="violet") |
AI Agent Copilots, LLM Workbenches, Chatbots | pdu.set_page_config(theme="violet") |
Emerald (theme="emerald") |
FinTech, Executive SaaS, Billing & MRR KPIs | pdu.set_page_config(theme="emerald") |
Zinc Dark (theme="zinc") |
DevOps, Kubernetes Telemetry, Dark Mode Analytics | pdu.set_page_config(theme="zinc", dark_mode=True) |
Amber (theme="amber") |
Logistics, E-Commerce Operations, Warehouse Fleet | pdu.set_page_config(theme="amber") |
📦 Installation
pip install pydataui
🚀 Track 1: Streamlit-Style Rapid Prototyping
Build complete data dashboards and AI interfaces with top-to-bottom procedural Python. No component trees, no classes, no decorators required:
import pydataui as pdu
import pandas as pd
# 1. Page Configuration & Theme
pdu.set_page_config(title="AI & Sales Intelligence", layout="wide", theme="zinc", dark_mode=True)
# 2. Modern Sidebar Controls
with pdu.sidebar():
pdu.title("Controls")
pdu.theme_toggle()
model = pdu.selectbox("Select Model", ["Llama-3.3", "DeepSeek-R1", "GPT-4o"])
temp = pdu.slider("Temperature", 0.0, 1.0, 0.7)
dataset = pdu.file_uploader("Upload Evaluation CSV", accept=[".csv"])
# 3. Main Dashboard Header & Status
pdu.title("GPU Cluster Telemetry & Agent Dispatch")
pdu.success("All 16 H100 SXM5 nodes online. Telemetry streaming active.")
# 4. Multi-Column KPI Grid
col1, col2, col3 = pdu.columns([1, 1, 1])
with col1:
pdu.metric("Active Sessions", "2,840", delta="+12.4%")
with col2:
pdu.metric("P99 Inference Latency", "14.2ms", delta="-3.1ms")
with col3:
pdu.metric("Token Throughput", "8.2k tokens/s", delta="+18.5%")
# 5. Interactive Tabs & Charts
tab_data, tab_chat = pdu.tabs(["Data Explorer", "Operations Copilot"])
with tab_data:
df = pd.DataFrame({
"Worker Node": [f"node-{i:02d}" for i in range(1, 5)],
"GPU Utilization": ["88%", "92%", "78%", "95%"],
"VRAM Allocated": ["72 GB", "76 GB", "64 GB", "78 GB"]
})
pdu.write(df) # Polymorphic auto-renderer: renders interactive paginated table
pdu.line_chart([65, 72, 80, 85, 92, 88, 91, 95])
with tab_chat:
with pdu.chat_message("user"):
pdu.write("Are there any thermal anomalies on worker nodes?")
with pdu.chat_message("assistant"):
pdu.write("All nodes operating within normal thermal limits. Peak VRAM was 78 GB on Node-04.")
pdu.chat_input("Ask the operations assistant a question...")
if __name__ == "__main__":
pdu.run(port=8000, share=True) # Ready in 3.5s with instant public HTTPS link!
Run it directly:
python app.py
- 🌐 Local Web UI:
http://127.0.0.1:8000 - 🔗 Instant Public Tunnel:
https://a1d60ba6d715e7.app.lhr.life - 📖 Interactive Swagger UI:
http://127.0.0.1:8000/docs
🧩 Advanced Layout, Positioning & Commercial Dashboard Guide (v1.4.4)
PyDataUI v1.4.4 introduces Next.js-level layout freedom and commercial primitives directly into Streamlit-style procedural Python:
1. Flexbox Layout Engine (pdu.flex, pdu.row, pdu.column)
Take complete control over alignment, justification, gaps, and wrapping with both with context managers and direct component arguments:
import pydataui as pdu
# Horizontal navigation bar with Flexbox between-alignment
with pdu.flex(direction="row", justify="between", align="center", gap=4):
pdu.subheader("Production Cluster")
with pdu.row(align="center", gap=2):
pdu.badge("Operational", color="emerald", variant="subtle")
pdu.badge("v1.4.4", color="indigo")
pdu.button("+ Deploy Pod", type="primary")
# Vertical stack with stretch alignment
with pdu.flex(direction="column", align="stretch", gap=3):
pdu.caption("Cluster Load")
pdu.progress(85)
2. Responsive CSS Grid Engine (pdu.grid)
Build auto-wrapping, responsive dashboard grids without writing a single CSS media query:
# Auto-responsive card grid: columns automatically wrap when cards reach 260px minimum width!
with pdu.grid(min_column_width="260px", gap=4):
pdu.stat_card("Active Nodes", "32 / 32", change="100% OK", sparkline=[10, 10, 10], color="emerald")
pdu.stat_card("P99 Latency", "8.2 ms", change="-2.1ms", sparkline=[14, 12, 10, 8], color="indigo")
pdu.stat_card("VRAM Allocated", "1,180 GB", change="+12%", sparkline=[60, 75, 85, 92], color="amber")
pdu.stat_card("Token Throughput", "18.4k t/s", change="+24.8%", sparkline=[12, 15, 17, 18], color="rose")
# Fixed 3-column grid with custom row and column gaps:
with pdu.grid(columns=3, row_gap=3, column_gap=6):
pdu.metric("Cluster CPU", "42%")
pdu.metric("Memory", "68%")
pdu.metric("Network I/O", "1.2 GB/s")
3. Coordinate Positioning Engine (Absolute & Relative)
Add floating status badges, absolute card overlays, and pinned toolbars:
# Elevated Card with Floating Absolute Badge pinned to top-right
with pdu.card(position="relative"):
pdu.badge("HOTSPOT DETECTED", color="rose", position="absolute", top="14px", right="14px")
pdu.title("Worker Node 04")
pdu.line_chart([65, 72, 80, 85, 94, 98, 82], color="rose")
# Pinned Bottom Toolbar (sticky action bar docked to viewport)
with pdu.pinned(position="bottom"):
with pdu.flex(justify="between", align="center", class_name="max-w-4xl mx-auto"):
pdu.text("3 worker nodes require kernel updates.")
pdu.button("Apply Batch Update", type="primary")
4. Advanced Tabs & Headless Multi-Step Wizards (pdu.tabs)
# 1. Full-width equal distribution tabs
tab_a, tab_b = pdu.tabs(["System Telemetry", "Security Audit"], expand=True)
# 2. Modern Segmented Pill Tabs
tab_week, tab_month = pdu.tabs(["7 Days", "30 Days"], variant="pill")
# 3. Headless Step-by-Step Wizard (tab headers completely hidden)
# Build custom multi-step onboarding, checkouts, and AI interview forms in 1 line!
steps = pdu.tabs(["Step 1: Account", "Step 2: Payment", "Step 3: Launch"], hide_tab_buttons=True)
with steps[0]:
pdu.text_input("Company Name")
pdu.button("Next: Payment →", on_click=lambda: pdu.session_state.update({"step": 1}))
5. Commercial Dashboard & Analytics Primitives
# 1. Status Badges (subtle, solid, outline with preset colors or custom hex)
pdu.badge("Online", color="emerald", variant="subtle")
pdu.badge("Critical", color="rose", variant="solid")
pdu.badge("Draft", color="zinc", variant="outline")
# 2. Pure SVG Inline Sparklines (zero external dependencies, renders in 0.001ms)
pdu.sparkline([12, 14, 18, 15, 22, 28, 35], color="indigo", height=32, fill=True)
# 3. Executive StatCard with Icon and Sparkline
pdu.stat_card(title="MRR Velocity", value="$154,200", change="+18.2%", sparkline=[90, 110, 130, 154], icon="📈", color="emerald")
# 4. Temporal Inputs bound to session_state
pdu.date_input("Audit Window", value="2026-11-18", key="audit_date")
pdu.time_input("Maintenance Schedule", value="02:00", key="maint_time")
# 5. Search Bar with Instant HTMX Callback
pdu.search_input(placeholder="Search telemetry logs...", key="log_query", on_search=filter_logs)
# 6. Commercial SaaS Pricing Cards
with pdu.grid(columns=3, gap=6):
pdu.pricing_card("Starter", "$29", features=["Up to 5 nodes", "Community Slack"])
pdu.pricing_card("Pro", "$149", features=["50 nodes", "24/7 SLA", "90-day logs"], highlighted=True, badge_label="BEST VALUE")
pdu.pricing_card("Enterprise", "Custom", features=["Unlimited nodes", "Dedicated VPC"])
# 7. Spacing Primitives
pdu.spacer(height=24) # 24px vertical spacer
pdu.divider(label="OR") # Horizontal divider with centered label
🧩 Layout Containers & Context Managers Guide
PyDataUI provides first-class support for Python context managers (with blocks) as well as direct method chaining across all structural layout primitives:
import pydataui as pdu
# 1. Elevated Cards with optional Title/Subtitle
with pdu.card(title="Account Settings", subtitle="Manage security and preferences"):
pdu.text_input("Display Name", key="user_name")
pdu.checkbox("Enable Two-Factor Authentication")
pdu.button("Save Preferences")
# 2. Scoped Containers (with optional card border styling)
with pdu.container(border=True):
pdu.subheader("Audit Log")
pdu.write("All system events are synchronized with SIEM.")
# 3. Horizontal & Vertical Stacks
with pdu.row():
pdu.button("Cancel", type="secondary")
pdu.button("Submit", type="primary")
with pdu.column():
pdu.caption("Step 1: Configuration")
pdu.caption("Step 2: Deployment")
# 4. Multi-Column Grid with Direct & Context Syntax
col1, col2 = pdu.columns([2, 1])
with col1:
pdu.metric("Throughput", "14.2k t/s", delta="+18%")
# Direct method call without `with` is also 100% supported!
col2.metric("P99 Latency", "12.8 ms", delta="-2.4ms")
# 5. Collapsible Expanders & Dialog Overlays
with pdu.expander("💡 Deep Reasoning Trace (1,420 tokens)"):
pdu.code("SELECT * FROM cluster_telemetry WHERE latency > 100;")
with pdu.dialog("Confirm Deletion"):
pdu.write("This action will permanently revoke the API key.")
pdu.button("Revoke Key", type="destructive")
# 6. Live Progress Status Containers
with pdu.status("Executing cluster deployment...", expanded=True) as s:
pdu.write("Validating manifest...")
pdu.write("Deploying 32 pods...")
s.update(label="Deployment Complete!", state="complete", expanded=False)
🔐 Multi-Page Apps, Signup & Production Authentication
Create complete enterprise SaaS user flows (Registration, Sign In, Role-Protected Dashboard) in pure procedural Python:
import pydataui as pdu
pdu.set_page_config(title="SaaS Portal", theme="indigo", dark_mode=True)
# 1. Public Registration Page
@pdu.page("/signup", public=True)
def signup_screen():
with pdu.card(title="Create Enterprise Account", subtitle="Get started in 30 seconds"):
with pdu.form("signup_form"):
pdu.text_input("Username", key="reg_user")
pdu.text_input("Work Email", key="reg_email")
pdu.text_input("Password", type="password", key="reg_pass")
def handle_signup():
u = pdu.session_state.get("reg_user")
p = pdu.session_state.get("reg_pass")
e = pdu.session_state.get("reg_email")
if not u or not p:
pdu.error("Please fill all required fields")
return
pdu.create_user(u, p, email=e, roles=["admin"])
pdu.login(u, p)
pdu.switch_page("/dashboard")
pdu.form_submit_button("Create Account & Launch", on_click=handle_signup)
# 2. Public Login Page
@pdu.page("/login", public=True)
def login_screen():
with pdu.card(title="Sign In", subtitle="Welcome back"):
with pdu.form("login_form"):
pdu.text_input("Username", key="login_user")
pdu.text_input("Password", type="password", key="login_pass")
def handle_login():
u = pdu.session_state.get("login_user")
p = pdu.session_state.get("login_pass")
if pdu.login(u, p):
pdu.switch_page("/dashboard")
else:
pdu.error("Invalid username or password")
pdu.form_submit_button("Sign In", on_click=handle_login)
# 3. Role-Protected Dashboard
@pdu.page("/dashboard", roles=["admin"])
def dashboard_screen():
with pdu.sidebar():
pdu.title("Ops Console")
pdu.write(f"Logged in as: **{pdu.session_state.get('user')}**")
pdu.button("Log Out", on_click=lambda: (pdu.logout(), pdu.switch_page("/login")))
pdu.title("Production Operations Dashboard")
col1, col2, col3 = pdu.columns(3)
col1.metric("Active Clusters", "32 / 32", delta="100% OK")
col2.metric("VRAM Pool", "1,180 GB", delta="92% Utilized")
col3.metric("Latency P99", "12.8 ms", delta="-2.4ms")
if __name__ == "__main__":
pdu.run(port=8000)
⚡ Track 2: Next.js-Style Full-Stack SaaS
When building complex, multi-page web applications, PyDataUI provides a Next.js App Router equivalent in pure Python:
from pydataui import App, Container, Card, Heading, Text, Button, Table, Row, state
from pydantic import BaseModel, Field
app = App(title="CloudAI Enterprise SaaS")
# 1. Server State & Server Actions (Next.js "use server" equivalent)
s = state(credits=1500, deployments=[{"id": "dep-01", "model": "Llama-3.3-70B", "status": "Running"}])
@s.action
def deploy_model(model_name: str = "Mistral-Large"):
s.deployments.append({"id": f"dep-0{len(s.deployments) + 1}", "model": model_name, "status": "Running"})
s.credits -= 100
# 2. Server-Rendered Component Page (app/page.tsx equivalent)
@app.page("/")
def dashboard_page():
return Container(
Row(
Heading("Enterprise AI Dashboard", level=1),
Button("+ Deploy Mistral", on_click=lambda: deploy_model("Mistral-Large"), variant="primary"),
class_name="flex justify-between items-center mb-6"
),
Card(
Heading("Remaining Credits", level=4),
Text(s.credits, class_name="text-2xl font-bold text-emerald-600"),
Table(data=s.deployments),
class_name="p-6 shadow-sm"
),
class_name="max-w-5xl mx-auto p-8"
)
# 3. Built-In FastAPI Route (Next.js route.ts / FastAPI API equivalent)
class PromptRequest(BaseModel):
prompt: str = Field(..., min_length=1)
@app.api("/api/v1/generate", method="POST", tags=["AI Inference"])
async def generate_api(body: PromptRequest):
return {"success": True, "output": f"Completion for: {body.prompt[:40]}..."}
if __name__ == "__main__":
app.run(port=8000)
⚖️ Streamlit-Style (Track 1) vs. Next.js-Style (Track 2): Which is Production-Grade?
A frequent question when adopting PyDataUI is whether Track 1 (Streamlit-style procedural pdu.*) is only for prototypes while Track 2 (Next.js-style declarative App(), Container()) is for production.
In PyDataUI, BOTH Track 1 and Track 2 are 100% Production-Grade.
Here is the architectural reason why:
- Track 1 is NOT Streamlit under the hood: It borrows Streamlit's ergonomic procedural syntax (
pdu.text_input,pdu.button,pdu.metric), but compiles to the exact same ASGI FastAPI backend and surgical HTMX DOM-diffing engine as Track 2. It never re-runs your script from line 1. It shares process memory, runs in Uvicorn multi-worker clusters, and exposes full Swagger docs at/docs. - Track 2 provides Next.js / React mental models: It uses explicit component trees (
Container,Row,Card) and declarative state bindings (s = state(),@s.action), which is ideal for large multi-engineer teams building modular component libraries.
When to Choose Which Track:
| Dimension | Track 1: Procedural (pdu.*) |
Track 2: Declarative (App(), Container()) |
|---|---|---|
| Syntax Style | Linear procedural Python (Streamlit-like) | Component tree & State objects (Next.js / React-like) |
| Production Ready? | Yes (100% FastAPI + HTMX) | Yes (100% FastAPI + HTMX) |
| Full-Script Re-runs? | ❌ Never (Surgical DOM fragment morphing) | ❌ Never (Targeted @s.action dispatch) |
| FastAPI Access & Docs | pdu.get_fastapi(), auto /docs |
app.fastapi, auto /docs |
| Best Team Fit | Solo developers, ML/AI engineers, fast MVPs | Multi-developer teams, large modular codebases |
| Component Layout | Scoped context managers (with pdu.card():) |
Hierarchical nesting (Container(Row(Card(...)))) |
| Server Concurrency | 1,000+ concurrent ASGI sessions | 1,000+ concurrent ASGI sessions |
🔌 Full FastAPI & Starlette Production Integration
Because PyDataUI runs on native FastAPI and Starlette, 100% of FastAPI and Starlette features work out of the box:
1. Direct Access to Underlying FastAPI Application
Access the underlying FastAPI instance at any time to register routers, background tasks, custom exception handlers, or dependency injection:
import pydataui as pdu
from fastapi import APIRouter, BackgroundTasks
# Access the FastAPI instance in Procedural DX or Full-Stack mode
fastapi_app = pdu.get_fastapi() # or app.fastapi
# Attach FastAPI APIRouter
router = APIRouter(prefix="/v1")
@router.post("/notify")
def send_notification(bg: BackgroundTasks):
bg.add_task(send_async_slack_alert, "Deployment succeeded")
return {"status": "enqueued"}
fastapi_app.include_router(router)
2. Starlette & FastAPI Middlewares (CORS, GZip, Security)
Attach any Starlette or FastAPI middleware directly:
from starlette.middleware.cors import CORSMiddleware
import pydataui as pdu
app = pdu.get_app()
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
3. Production Swagger UI Hardening & Customization
Take full control over API documentation when moving to production:
import pydataui as pdu
# Option A: Completely remove /docs and /openapi.json in production
pdu.set_page_config(docs_url=None, openapi_url=None)
# Option B: Filter and customize Swagger UI parameters
pdu.set_page_config(
swagger_ui_parameters={
"filter": True, # Enable instant search filter in Swagger
"defaultModelsExpandDepth": -1, # Hide data models by default
"syntaxHighlight.theme": "monokai", # Custom code highlighting theme
"persistAuthorization": True # Remember auth tokens across refreshes
}
)
# Option C: Lock down /docs behind Role-Based Authentication
# Only users logged in with the "admin" role can access the Swagger UI!
pdu.set_page_config(docs_roles=["admin"])
4. 1-Line FastAPI Mounting
Already have an existing FastAPI backend or microservice? Mount PyDataUI with a single line:
from fastapi import FastAPI
from pydataui import App, Container, Heading
# 1. Existing Enterprise FastAPI Application
api = FastAPI(title="Core Microservice")
@api.get("/api/health")
def health():
return {"status": "healthy"}
# 2. Build PyDataUI Dashboard
dashboard = App(title="Ops Portal")
@dashboard.page("/")
def ops_home():
return Container(Heading("Operations Portal"))
# 3. Mount directly — 1 process, 1 port, 0ms in-memory access!
api.mount("/dashboard", dashboard.fastapi)
Run with standard Uvicorn:
uvicorn main:api --reload --port 8000
- 📡 FastAPI API:
http://127.0.0.1:8000/api/health - 📖 FastAPI Docs:
http://127.0.0.1:8000/docs - 💻 PyDataUI Dashboard:
http://127.0.0.1:8000/dashboard/
🎨 20 Modern Themes + Infinite Custom Palettes
PyDataUI ships with 20 official out-of-the-box color presets matching all standard Shadcn/Tailwind design systems:
| Category | Presets Available | Hex Identifiers |
|---|---|---|
| Modern Neutrals | zinc, slate, stone, neutral, gray |
#18181b • #0f172a • #1c1917 • #171717 • #111827 |
| Greens & Cyans | emerald, green, teal, cyan |
#059669 • #16a34a • #0d9488 • #0891b2 |
| Blues & Purples | blue, indigo, violet, purple |
#2563eb • #4f46e5 • #7c3aed • #9333ea |
| Pinks & Warm | fuchsia, pink, rose, red, orange, amber, yellow |
#c026d3 • #db2777 • #e11d48 • #dc2626 • #ea580c • #d97706 • #ca8a04 |
🖼️ High-Fidelity UI Gallery: See What You Can Build
🔮 1. AI Copilot & Agent Playground (theme="violet")
Built for LLM workbenches, multi-turn chat agents, and real-time inference telemetry. Features collapsible reasoning thought traces, token speed counters, and syntax-highlighted code output:
import pydataui as pdu
# 1. Page Configuration & Theme
pdu.set_page_config(title="DeepAgent Copilot", theme="violet", dark_mode=True)
# 2. Left Control Sidebar
with pdu.sidebar():
pdu.header("DeepAgent Copilot")
pdu.caption("Powered by PyDataUI v1.5.1")
pdu.divider()
model = pdu.selectbox("INFERENCE MODEL", ["DeepSeek-R1-Distill-70B", "Llama-3.3-70B"])
temp = pdu.slider("TEMPERATURE (0.70)", 0.0, 1.0, 0.70)
pdu.caption("CONTEXT (32k / 64k)")
pdu.progress(50)
pdu.text_area(
"SYSTEM PROMPT",
value="You are an autonomous SRE copilot monitoring 16 H100 distributed worker nodes...",
height=80
)
pdu.button("+ New Agent Session", type="primary")
# 3. Main Chat Top Bar with Live Telemetry Badges
with pdu.flex(justify="between", align="center", class_name="mb-4 pb-3 border-b border-border/40"):
with pdu.column(gap=0):
pdu.subheader("Cluster Diagnostic Agent")
pdu.caption("Session: #agent-session-8492 • Zero-latency in-memory bridge")
with pdu.row(gap=2):
pdu.badge("⚡ 84.6 t/s", color="violet", variant="subtle")
pdu.badge("✓ Latency: 12ms", color="emerald", variant="subtle")
# 4. Multi-Turn Diagnostic Chat Stream
with pdu.chat_message("user"):
pdu.write("Analyze the P99 latency spike on cluster node-04 and remediate.")
with pdu.chat_message("assistant"):
with pdu.expander("💡 Thought Process: 1,420 tokens analyzed (0.4s)", expanded=True):
pdu.write(
"I inspected real-time Prometheus traces on **node-04**. A cache compaction deadlock "
"triggered temporary VRAM starvation. Executing zero-downtime rebalance:"
)
pdu.code("""import pydataui as pdu
await cluster.isolate_node("node-04", drain_timeout=15)
# In-memory execution: 0ms network hop, cluster stabilized!""", language="python")
pdu.success(
"**Remediation Executed Successfully** \n"
"P99 Latency dropped from 284ms to 12.1ms • All 32 pods re-routed to node-05 and node-06"
)
# 5. Bottom Interactive Prompt Input
pdu.chat_input("Ask Copilot to run cluster commands, query metrics, or debug models...")
if __name__ == "__main__":
pdu.run(port=8000, share=True) # Instantly generates public HTTPS link!
💎 2. FinTech, Billing & Revenue Analytics (theme="emerald")
Engineered for SaaS metrics, ARR/MRR acceleration, transaction ledgers, and executive board reporting:
import pydataui as pdu
import pandas as pd
# 1. Page Configuration & Theme
pdu.set_page_config(title="ApexPay Financial", theme="emerald", layout="wide", dark_mode=True)
# 2. Commercial Top Navigation Bar
pdu.navbar(
title="ApexPay",
logo="💳",
links=[
{"label": "Overview", "href": "/"},
{"label": "Invoices", "href": "/invoices"},
{"label": "Customers", "href": "/customers"},
{"label": "Webhooks", "href": "/webhooks"},
{"label": "REST API", "href": "/docs"}
],
search=False
)
# 3. 4 Executive KPI Cards
col1, col2, col3, col4 = pdu.columns([1, 1, 1, 1])
with col1: pdu.metric("Annual Run Rate (ARR)", "$1,840,500", delta="+24.8%")
with col2: pdu.metric("Monthly Recurring (MRR)", "$154,200", delta="+18.2%")
with col3: pdu.metric("Paying Accounts", "2,840", delta="+142 mo")
with col4: pdu.metric("Net Retention Rate", "118.4%", delta="TOP 5%")
# 4. Main Chart & Billing Channels Split Row
chart_col, split_col = pdu.columns([2, 1])
with chart_col:
with pdu.card(title="MRR Acceleration & Cohort Revenue", subtitle="Real-time telemetry morphing via HTMX • In-memory compute"):
pdu.area_chart([92, 104, 118, 132, 145, 154]) # Peaks at $154,200 (Nov)
with split_col:
with pdu.card(title="Billing Channels", subtitle="Enterprise vs Self-Serve"):
pdu.caption("Enterprise Wire / Invoicing (68%) — **$104.8k**")
pdu.progress(68)
pdu.caption("Credit Card Auto-Billing (24%) — **$37.0k**")
pdu.progress(24)
pdu.caption("Automated ACH Direct (8%) — **$12.4k**")
pdu.progress(8)
# 5. Recent Commercial Invoices Ledger
pdu.subheader("Recent Commercial Invoices")
df_invoices = pd.DataFrame({
"CUSTOMER": ["Stripe Global AI Labs", "HuggingFace Enterprise", "Anthropic Partner Node"],
"INVOICE ID": ["inv_2026_9841", "inv_2026_9842", "inv_2026_9843"],
"PLAN TIER": ["Enterprise Dedicated (128x H100)", "Scale AI Tier (64x A100)", "Claude 3.5 Sonnet Integration"],
"BILLING CYCLE": ["Annual (Prepaid)", "Monthly Usage", "Net-15 Invoice"],
"AMOUNT": ["$48,000.00", "$22,450.00", "$18,900.00"],
"STATUS": ["PAID ✓", "PAID ✓", "PENDING"]
})
pdu.table(df_invoices)
if __name__ == "__main__":
pdu.run(port=8000)
⚡ 3. DevOps, Cluster Telemetry & Dark Mode Analytics (theme="zinc", dark_mode=True)
High-density, low-eye-strain telemetry for Kubernetes clusters, GPU farms, and real-time distributed systems:
import pydataui as pdu
import pandas as pd
# 1. Page Configuration & Theme
pdu.set_page_config(title="Cluster Telemetry", theme="zinc", layout="wide", dark_mode=True)
# 2. Left Telemetry & Node Navigation Sidebar
with pdu.sidebar():
pdu.header("Cluster Telemetry")
pdu.caption("Kubernetes H100 Mesh")
pdu.divider()
cluster = pdu.selectbox("ACTIVE CLUSTER", ["us-east-h100-prod", "eu-central-a100-prod"])
pdu.radio("Navigation", [
"📊 Overview & Health",
"🖥️ GPU Nodes (16)",
"📦 Active Pods (128)",
"⚡ Token Throughput",
"🚨 Alert Channels (0)",
"🛠️ OpenAPI REST /docs"
])
with pdu.card(title="Cluster Resources"):
pdu.caption("CPU Allocation (48%)")
pdu.progress(48)
pdu.caption("VRAM Usage (88%)")
pdu.progress(88)
pdu.caption("PCIe Bandwidth (94%)")
pdu.progress(94)
pdu.caption("🟢 All 16 nodes operating at 100%")
# 3. Main Dashboard Header & Quick Action Buttons
with pdu.flex(justify="between", align="center", class_name="mb-4 pb-3 border-b border-border/40"):
with pdu.column(gap=0):
pdu.subheader("Real-Time Cluster Telemetry")
pdu.caption("Streaming in-process telemetry • 0ms API overhead")
with pdu.row(gap=2):
pdu.button("📥 Export Parquet")
pdu.button("⚡ Drain & Rebalance", type="destructive")
# 4. 4 High-Density KPI Metrics
col1, col2, col3, col4 = pdu.columns(4)
with col1: pdu.metric("P99 Inference Latency", "12.8 ms", delta="-2.4ms")
with col2: pdu.metric("VRAM Allocated", "1,180 GB", delta="92.1%")
with col3: pdu.metric("Active Model Pods", "32 / 32", delta="100% OK")
with col4: pdu.metric("Token Throughput", "14.2k t/s", delta="+18%")
# 5. Dual-Series Telemetry Line Chart
with pdu.card(title="Token Throughput (t/s) vs Inference Latency (ms)"):
pdu.line_chart([140, 110, 125, 75, 60, 45])
# 6. Worker Nodes Real-Time Status Table
pdu.subheader("Active Worker Nodes")
df_nodes = pd.DataFrame({
"WORKER NODE": ["us-east-h100-01", "us-east-h100-02", "us-east-h100-03"],
"HARDWARE": ["8x H100 SXM5 80GB", "8x H100 SXM5 80GB", "8x H100 SXM5 80GB"],
"TEMP": ["64°C", "66°C", "71°C"],
"GPU LOAD": ["94% VRAM", "92% VRAM", "98% VRAM"],
"STATUS": ["ONLINE", "ONLINE", "ONLINE"]
})
pdu.table(df_nodes)
if __name__ == "__main__":
pdu.run(port=8000)
Zero Theme Limitations: Custom Palettes & Brand Colors
You are never limited to presets. Define any custom brand palette via hex code or custom dictionary:
# 1. Built-in Preset
pdu.set_page_config(theme="violet")
# 2. Custom Brand Hex
pdu.set_page_config(theme="#4f46e5")
# 3. Unlimited Custom Dictionary Palette
pdu.set_page_config(theme={
"primary": "#6366f1",
"primary_hover": "#4f46e5",
"bg": "#0f172a",
"accent": "#a855f7"
})
⚖️ Architectural Trade-Offs, The 5 Limitations & Advantage Comparison
When choosing a framework for commercial SaaS, internal tools, or AI platforms, understanding both where PyDataUI wins and its concrete limitations is essential.
🏆 Where PyDataUI Outperforms Next.js, FastAPI & Streamlit
- 0.02ms In-Memory Model Access: Your UI and your AI models (PyTorch, LangChain, Ollama, Pandas, Polars) share the exact same Python process memory. No JSON serialization overhead, zero internal REST/gRPC latency hops.
- 1 Language & 1 Runtime: 100% pure Python. Zero
package.json, zero Webpack/Turbopack bundling, zero npm security vulnerabilities, and 0 MBnode_modules(saving ~450 MB). - Surgical HTMX DOM Morphing: Unlike Streamlit (which re-executes lines 1–100 on every user click), PyDataUI dispatches only the targeted state action and surgical DOM swap, eliminating session sync bugs and lag.
- Native FastAPI & Auto OpenAPI 3.1: Built directly on FastAPI and Starlette. Every state action can automatically expose an OpenAPI 3.1 REST route with interactive Swagger UI at
/docs. - Unified Full-Stack Deployment: 1 process, 1 port. Deploy via standard Docker, Uvicorn, or launch an instant secure public HTTPS tunnel in 3.5 seconds with
share=True.
⚠️ The 5 Concrete Architectural Limitations of PyDataUI vs Next.js
Being completely transparent about what PyDataUI is and is not designed for:
- Zero Offline-First Apps (Network & Server Dependency):
- Next.js: Can bundle client-side React code running entirely inside the browser without contacting a server (e.g., offline PWAs, local SQLite via WASM, client-side canvas tools).
- PyDataUI: Is server-driven. When a user types in a form or clicks a dynamic button, HTMX sends a lightweight request to the Python backend and swaps the returned HTML fragment. If internet connectivity drops, dynamic server callbacks pause until reconnected.
- Verdict: Not suited for offline-first progressive web apps.
- Canvas-Heavy, 120 FPS Client-Side Tools (Figma, Canva, Video/Audio Editors, WebGL Games):
- Next.js: Excels at client-only apps requiring thousands of real-time GPU-driven vector calculations running at 120 FPS directly on the client canvas.
- PyDataUI: Engineered for data products, SaaS platforms, AI copilots, executive dashboards, and B2B portals. It is not designed to build an in-browser Photoshop or a 3D gaming engine.
- Verdict: For browser graphic engines or games, use Next.js / WebGL.
- The Vast 3rd-Party NPM React Component Ecosystem (2M+ Packages):
- Next.js: Has access to 2M+ NPM packages. If you need a hyper-niche widget (e.g.
react-flowfor node-based graphs,tiptapfor collaborative rich-text Google Docs), you cannpm installit in seconds. - PyDataUI: Ships with 40+ curated enterprise components (DataTables, Metrics, StatCards, Sparklines, Badges, Charts, Chat, Tabs). Hyper-niche React widgets require wrapping via custom web components or iframe.
- Verdict: If your core differentiator is an existing proprietary React widget library, Next.js has the ecosystem edge.
- Next.js: Has access to 2M+ NPM packages. If you need a hyper-niche widget (e.g.
- Python GIL & CPU-Bound Blocking Concurrency:
- Next.js / Node.js: V8 event loop handles high-concurrency non-blocking I/O.
- PyDataUI: Runs on Python. Heavy CPU-bound computation (e.g. distributed ML training or massive image transformation) on the main event loop will block other requests unless explicitly offloaded to
BackgroundTasks,multiprocessing, or Celery/Redis workers. - Verdict: CPU-heavy tasks must use asynchronous background workers.
- 0ms Optimistic Client UI Updates:
- Next.js / React: Allows client-side "optimistic updates" where a button or toggle flips in 0ms on the client before the server acknowledges the write.
- PyDataUI: Waits for the server roundtrip (~10ms–25ms over broadband) before morphing the DOM fragment.
- Verdict: Perfectly responsive for 99% of business dashboards and SaaS, but not 0ms client-side optimistic simulation.
📊 4-Way Comprehensive Architecture Comparison
| Feature / Dimension | Next.js (Node.js) | FastAPI (Backend Only) | Streamlit (Python) | PyDataUI v1.5.1 (Full-Stack) |
|---|---|---|---|---|
| Languages Required | 2 (TypeScript + Python) | 1 (Python backend only) | 1 (Python) | 1 (Pure Python Full-Stack) |
| UI Presentation Layer | React / Virtual DOM | ❌ None (API only) | Python procedural widgets | Server-Side HTMX DOM Morphing |
| Execution on Click | Client-side re-render | N/A (REST endpoint) | ❌ Reruns script lines 1-100 | Surgical fragment swap (0 rerun) |
| Model / Data Latency | 15ms–60ms (JSON HTTP hop) | 0.02ms (In-Memory) | 0.02ms (In-Memory) | 0.02ms (Direct process memory) |
| Build & Dependencies | 450 MB+ node_modules |
Clean Python | Clean Python | Clean Python (0 MB npm) |
| Built-in REST API & Docs | Manual route handlers | OpenAPI 3.1 Swagger | ❌ None | Auto OpenAPI 3.1 Swagger UI |
| Responsive Flex & Grid | Tailwind CSS | ❌ None | ❌ Primitive columns only | Native pdu.flex & pdu.grid |
| Coordinate Positioning | Tailwind CSS | ❌ None | ❌ None | Native props (top, right, etc.) |
| Public Sharing Demos | Manual Vercel / Cloud | Manual cloud hosting | Cloud login required | share=True (3.5s instant tunnel) |
| Memory per User Session | Low (Client-side) | Stateless | ❌ High (Duplicate DataFrames) | Ultra-Low (Shared memory) |
💡 Is Streamlit Only for Prototyping or Full-Stack MVPs?
Streamlit is architecturally optimized for rapid exploratory prototyping and internal data apps, not commercial full-stack SaaS MVPs.
- The Re-Run Barrier: Every user click re-runs your script from line 1. For complex customer-facing workflows, payment flows, or stateful onboarding, this leads to state race conditions, flashing spinners, and accidental duplicate database queries.
- No Real Backend/Webhooks: Streamlit lacks a REST API routing engine. You cannot easily listen for Stripe webhooks (
/api/webhooks/stripe) or expose API endpoints for mobile or external clients. - Memory & Concurrency Ceiling: Persistent WebSockets per tab and duplicated in-memory DataFrames often cause memory exhaustion (OOM) at 20–50 concurrent users.
- Why PyDataUI Bridges the Gap: PyDataUI retains Streamlit's 1-line procedural simplicity (
pdu.text_input,pdu.button,pdu.metric) while running on FastAPI and HTMX—giving you surgical DOM updates (0 script reruns), real REST endpoints, background tasks, and commercial Shadcn visual polish.
⚡ Next.js-Style Architecture in Pure Python
PyDataUI delivers the core architecture developers love about Next.js, implemented in 100% pure Python without node_modules:
- Next.js App Router Equivalent:
@app.page("/dashboard")route decorators with automatic layout nesting. - Route Handlers / API Equivalent:
@app.api("/api/v1/generate", method="POST")with automatic OpenAPI 3.1 Swagger docs. - React Server Components (RSC) Equivalent: Server-rendered Python component trees compiled directly to semantic HTML.
- Next.js Streaming Equivalent:
pdu.write_stream(gen)for real-time LLM token streaming over Server-Sent Events (SSE). - Modern Design Tokens: Native Tailwind utility classes (
class_name="...") and 20+ official Shadcn theme presets.
See docs/PYDATAUI_VS_REACT_AND_STREAMLIT.md for the full architectural breakdown.
📦 Optional Extensions (Mobile, Desktop, TUI)
PyDataUI keeps its web core ultra-lean. Specialized native deployment targets are available as optional extensions:
- 📱 Mobile Apps (Capacitor / iOS / Android): Package as native mobile apps with camera, GPS, and offline PWA support (Documentation).
- 💻 Desktop Apps (Tauri / pywebview): Package into a standalone ~15 MB desktop
.appor.exewith zero Electron bloat. - 📟 Terminal UI (TUI): Run headless telemetry monitors on remote SSH GPU clusters via
pydataui tui app.py.
🤝 Community & Support
- 📖 Full Documentation: https://rajboopathiking.github.io/pydataui/
- 📦 PyPI Package: https://pypi.org/project/pydataui/
- ⭐ GitHub Star: Support the project by starring the repository on GitHub!
Licensed under the MIT License.
Metadata
Release files for pydataui 1.5.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pydataui-1.5.1.tar.gz | 347.5 kB | Without provenance | Details for pydataui-1.5.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pydataui-1.5.1-py3-none-any.whl | Python 3 | none | any | Details for pydataui-1.5.1-py3-none-any.whl |
Total release size: 621.5 kB
Release files / pydataui-1.5.1.tar.gz
| Download URL | pydataui-1.5.1.tar.gz |
|---|---|
| Size | 347.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
69544b0d6f50c159413fda58c3c51a20300a9bf2003cca32a276facdd62cdbd7
|
|
BLAKE2b-256 checksum How to use checksums |
593f5f266294de3cd59f37a08d7ecdaf46005fb9f43b3c3e46bf234acc9fdb39
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.9
|
Release files / pydataui-1.5.1-py3-none-any.whl
| Download URL | pydataui-1.5.1-py3-none-any.whl |
|---|---|
| Size | 274.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a65a4aa531020f034eff45663db4bd1a65832b283ee7367825868f4100bf4f80
|
|
BLAKE2b-256 checksum How to use checksums |
5079c1894c5c0a6db171d293cf5c0cee70c16abbbb3807aa689e98ea76ce5a9c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.9
|
Security for pydataui 1.5.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.