Skip to main content

A Databricks-first Python UI framework for building secure dashboards, portals, and web apps with pure Python.

Project description

BrickflowUI

Canonical package name: brickflowui

Install with:

pip install brickflowui

Import with:

import brickflowui as db

Start here:

Release Notes

  • PyPI package name is brickflowui
  • CLI command: brickflowui
  • Standard Python import remains brickflowui
  • Source distributions and wheels include bundled frontend assets plus docs/examples

Databricks-first, React-style Python UI library for building composable, production-ready Databricks Apps โ€” without writing a single line of JavaScript.

Python License


What is BrickflowUI?

BrickflowUI lets data engineers build beautiful, interactive Databricks Apps in pure Python. It ships a pre-built React frontend and communicates over WebSocket, so you get:

  • โšก No full-script reruns โ€” only changed components re-render (unlike Streamlit)
  • ๐Ÿงฉ React-style component model โ€” composable functions, hooks, one-way data flow
  • ๐Ÿ”’ Databricks-native โ€” reads DATABRICKS_APP_PORT, Unity Catalog helpers, SQL warehouse wrappers
  • ๐ŸŽจ Beautiful dark theme โ€” Databricks-inspired design system, no CSS required

BrickflowUI is an independent project and is not affiliated with Nike's Brickflow workflow framework.


Quick Start

pip install brickflowui

# Scaffold a new app
brickflowui new my_app
cd my_app

# Run locally
brickflowui dev
# โ†’ open http://localhost:8050

Or manually:

# app.py
import brickflowui as db

app = db.App(title="My Databricks App")

@app.page("/", title="Home", icon="Home")
def home():
    count, set_count = db.use_state(0)
    return db.Column([
        db.Text("Counter", variant="h1"),
        db.Text(f"Count: {count}", variant="h3"),
        db.Button("Increment", on_click=lambda: set_count(count + 1)),
    ], padding=6)

if __name__ == "__main__":
    app.run()

Core Concepts

Components

Every UI element is a plain Python function returning a VNode:

import brickflowui as db

# Layout
db.Column(children, gap=4, padding=6)
db.Row(children, gap=2, justify="between")
db.Grid(children, cols=3, gap=4)
db.Card(children, title="My Card")

# Typography
db.Text("Hello!", variant="h1")   # h1, h2, h3, h4, body, caption, label, code

# Controls
db.Button("Click me", on_click=handler, variant="primary")
db.Input(name="q", label="Search", on_change=setter)
db.Select(name="w", options=[{"label": "A", "value": "a"}], on_change=setter)
db.Checkbox(name="x", label="Enable", on_change=setter)
db.Toggle(name="y", label="Dark mode", on_change=setter)
db.Slider(name="s", min=0, max=100, on_change=setter)
db.DateRangePicker(name="window", on_change=setter)
db.MultiSelect(name="layers", options=[...], values=["gold"], on_change=setter)

# Data
db.Table(data=rows, columns=[{"key": "id", "label": "ID"}], pagination=20, exportable=True)
db.Badge("Active", color="green")
db.Alert("Something went wrong", type="error")
db.Progress(value=65, max=100)
db.Stat(label="Queries", value="248K", delta="+12%", delta_type="increase")
db.EmptyState("No data", "Adjust filters or connect a source")
db.Toast("Saved", title="Success")
db.Timeline([{"title": "Run started", "time": "09:30"}])
db.SparklineStat(label="Freshness", value="17 min", data=rows, x_key="week", y_key="value")

# Charts
db.AreaChart(data=rows, x_key="date", y_keys=["value"], colors=["#FF3621"])
db.BarChart(data=rows, x_key="category", y_keys=["count"])
db.LineChart(data=rows, x_key="day", y_keys=["metric"])
db.DonutChart(data=rows, value_key="count", label_key="name")

# Navigation
db.Tabs([db.TabItem("Tab A", [db.Text("Content A")]), ...])
db.Sidebar([db.NavItem("Home", "/", icon="Home"), ...], brand_name="My App")
db.Modal(visible=True, title="Confirm", children=[...], on_close=handler)
db.Drawer(visible=True, title="Details", children=[...], on_close=handler)
db.Accordion([db.AccordionItem("Section", [db.Text("Body")])])
db.Breadcrumbs([{"label": "Home", "path": "/"}, {"label": "Reports"}])

# Forms
db.Form(action="/api/submit", success_redirect="/", children=[
    db.Input(name="username", label="Username"),
    db.Button("Submit", html_type="submit"),
])

# Databricks-specific
db.CatalogBrowser(on_select=handler)
db.WarehouseSelector(on_select=handler)
db.JobTrigger(job_id="123", label="Run Pipeline")

State (Hooks)

@app.page("/")
def my_page():
    count, set_count = db.use_state(0)          # local state
    data = db.use_memo(load_data, deps=[count])  # memoized compute
    db.use_effect(lambda: print("mounted"), [])  # side effects
    theme = db.use_context("theme")              # session context

    return db.Button(str(count), on_click=lambda: set_count(count + 1))

Multi-page Apps

app = db.App(title="Ops Hub")

@app.page("/", title="Dashboard", icon="LayoutDashboard")
def dashboard(): ...

@app.page("/tables", title="Tables", icon="Database")
def tables(): ...

@app.page("/settings", title="Settings", icon="Settings")
def settings(): ...

Auth And Access Control

import brickflowui as db

app = db.App(
    title="Ops Hub",
    auth_mode="hybrid",  # "app", "user", or "hybrid"
    auth_provider=db.HeaderAuthProvider(),
)

@app.page("/", title="Home")
def home():
    principal = db.current_principal()
    return db.Text(f"Hello {principal.display_name or principal.subject}")

@app.page("/admin", title="Admin", access="user", roles=["admin"])
def admin():
    user = db.require_role("admin")
    return db.Text(f"Welcome, {user.subject}")

@app.route("/api/profile", methods=["GET"], access="user")
async def profile():
    user = db.require_auth()
    return {"user": user.subject, "roles": list(user.roles)}

access supports:

  • public รขโ‚ฌโ€ anyone can access it
  • authenticated รขโ‚ฌโ€ any authenticated principal
  • user รขโ‚ฌโ€ requires a signed-in user identity
  • app รขโ‚ฌโ€ restricted to the shared application identity

Branding And Themes

app = db.App(theme="branding.yaml")

Example branding.yaml:

branding:
  title: "Acme Ops Portal"
  logo: "/static/acme-logo.svg"
  favicon: "/static/acme-favicon.ico"

colors:
  primary: "#FF5F2E"
  primary_hover: "#D9481C"
  background: "#F7F7F5"
  surface: "#FFFFFF"
  text: "#18181B"
  text_muted: "#71717A"
  border: "#E4E4E7"

typography:
  font_family: "'IBM Plex Sans', sans-serif"
  base_size: "15px"

spacing:
  unit: "6px"

borders:
  radius: "14px"

Supported theme model sections:

  • branding: title, logo, favicon
  • colors: primary, primary_hover, background, surface, text, text_muted, border, success, warning, error, link
  • surfaces: background, surface, overlay
  • typography: font_family, font_mono, base_size
  • spacing: unit
  • borders: radius
  • shadows: small, medium, large
  • motion: duration_fast, duration_normal, duration_slow, easing_standard, stagger_step

You can also keep using the lower-level internal keys like primary-hover, bg, text-muted, sans, and base-size if you prefer.

Custom API Routes

@app.route("/api/submit", methods=["POST"])
async def submit_handler():
    from fastapi.responses import JSONResponse
    return JSONResponse({"status": "ok"})

Databricks Integration

SQL Queries

from brickflowui.databricks import sql

# Returns a pandas DataFrame
df = sql.query("SELECT * FROM catalog.schema.table LIMIT 100")

# Returns list[dict] (for db.Table component)
rows = sql.query_to_records("SELECT id, name FROM my_table")
return db.Table(data=rows)

Set environment variables (or use app.yaml):

DATABRICKS_HOST=https://adb-xxx.azuredatabricks.net
DATABRICKS_TOKEN=dapiXXXXXXXX
DATABRICKS_WAREHOUSE_ID=your-warehouse-id

Unity Catalog

from brickflowui.databricks import uc

catalogs = uc.list_catalogs()
schemas  = uc.list_schemas("main")
tables   = uc.list_tables("main", "gold")
rows     = uc.get_table("main", "gold", "fact_orders", limit=50)

Deploying to Databricks Apps

app.yaml

command:
  - python
  - app.py

env:
  - name: DATABRICKS_WAREHOUSE_ID
    value: your-warehouse-id

Then in the Databricks workspace:

  1. Create a new Databricks App
  2. Upload your project as a ZIP (include app.py, app.yaml, requirements.txt)
  3. The app binds to DATABRICKS_APP_PORT automatically

requirements.txt

brickflowui>=0.1.4
# brickflowui[databricks]  # for SQL + Unity Catalog

CLI Reference

Command Description
brickflowui new <name> Scaffold a new app
brickflowui dev Run local dev server (hot reload)

Project Structure

brickflowui/
โ”œโ”€โ”€ __init__.py          # Public API
โ”œโ”€โ”€ app.py               # App class
โ”œโ”€โ”€ vdom.py              # Virtual DOM + diff algorithm
โ”œโ”€โ”€ state.py             # Hooks (use_state, use_effect, use_memo)
โ”œโ”€โ”€ components.py        # All component primitives
โ”œโ”€โ”€ server.py            # FastAPI ASGI + WebSocket server
โ”œโ”€โ”€ cli/
โ”‚   โ”œโ”€โ”€ main.py          # CLI (typer)
โ”‚   โ””โ”€โ”€ templates/       # App scaffolding templates
โ”œโ”€โ”€ databricks/
โ”‚   โ”œโ”€โ”€ env.py           # DATABRICKS_* env helpers
โ”‚   โ”œโ”€โ”€ sql.py           # SQL connector wrappers
โ”‚   โ””โ”€โ”€ uc.py            # Unity Catalog helpers
โ””โ”€โ”€ frontend/
    โ””โ”€โ”€ dist/            # Pre-built React bundle (served automatically)

examples/
โ”œโ”€โ”€ counter/             # Minimal Counter example
โ””โ”€โ”€ demo_app/            # Full multi-page dashboard demo
    โ”œโ”€โ”€ app.py
    โ”œโ”€โ”€ app.yaml
    โ””โ”€โ”€ requirements.txt

Architecture

Python App (app.py)
    โ”‚
    โ”‚  Component tree (VNode)
    โ–ผ
BrickflowUI Runtime
    โ”‚  FastAPI ASGI Server
    โ”‚  WS /events   โ”€โ”€โ”€โ”€ JSON patches โ”€โ”€โ”€โ”€โ–ถ  React Frontend
    โ”‚  GET /         โ—€โ”€โ”€โ”€ HTML shell โ”€โ”€โ”€โ”€โ”€โ”€
    โ”‚  GET /static/* โ—€โ”€โ”€โ”€ React bundle โ”€โ”€โ”€โ”€
    โ”‚
    โ–ผ
Databricks Runtime
    (DATABRICKS_APP_PORT, SQL warehouse, Unity Catalog)

License

MIT ยฉ BrickflowUI Contributors

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

brickflowui-0.1.4.tar.gz (254.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

brickflowui-0.1.4-py3-none-any.whl (215.5 kB view details)

Uploaded Python 3

File details

Details for the file brickflowui-0.1.4.tar.gz.

File metadata

  • Download URL: brickflowui-0.1.4.tar.gz
  • Upload date:
  • Size: 254.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for brickflowui-0.1.4.tar.gz
Algorithm Hash digest
SHA256 9c0a6d9b4bfdbdc4b34253a4a4ac8dff8312ed62262b537d4834ba6448d05ccf
MD5 615fd1df9248b7d773848f0fc88cc2e0
BLAKE2b-256 0c58bf85c45c987db4af075864703bdffa490250bc92a80d4fb91087b8ad6ab6

See more details on using hashes here.

Provenance

The following attestation bundles were made for brickflowui-0.1.4.tar.gz:

Publisher: publish.yml on AjayAJ2000/brickflowUI

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file brickflowui-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: brickflowui-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 215.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for brickflowui-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 e514d3f5a571098909346fdfb1a3388f3c182d089c80cbc21b5a431b6f1262d5
MD5 d2ae0bfae7605377351dcf1f28a50fef
BLAKE2b-256 d4f14abf6ce5bafe559c62417872c4ba3ab4a4c67162d2c824c983b79afdf053

See more details on using hashes here.

Provenance

The following attestation bundles were made for brickflowui-0.1.4-py3-none-any.whl:

Publisher: publish.yml on AjayAJ2000/brickflowUI

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page