Skip to main content

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

Project description

BricksFlowUI

Canonical package name: bricksflowui

Install with:

pip install bricksflowui

Import with:

import brickflowui as db

Start here:

Release Notes

  • PyPI package name is now bricksflowui
  • CLI commands supported: brickflowui and bricksflowui
  • 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 BricksFlowUI?

BricksFlowUI 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

Quick Start

pip install bricksflowui

# 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)

# Data
db.Table(data=rows, columns=[{"key": "id", "label": "ID"}], pagination=20)
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")

# 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)

# 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
  • typography: font_family, font_mono, base_size
  • spacing: unit
  • borders: radius

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

bricksflowui>=0.1.0
# bricksflowui[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.0.tar.gz (53.4 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.0-py3-none-any.whl (39.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for brickflowui-0.1.0.tar.gz
Algorithm Hash digest
SHA256 74bf5da6f8abc05212289b39a47ec21c8db88a7c6f12fa211224246afddcfaeb
MD5 1714a1d6e2fdc98e4df20c942dca5a3c
BLAKE2b-256 d13a0d9a64fe54407db148d3f18721b2327ef61273e300d8723ca106344e185e

See more details on using hashes here.

Provenance

The following attestation bundles were made for brickflowui-0.1.0.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.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for brickflowui-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 585a2e3595092d80add6cbd0e2b1c67f9022640d57fa7f61dc44f66fed905da7
MD5 7658a591e063fbf843d338fd9afa42e6
BLAKE2b-256 ba720ea201d3806e404fc28b3052f14624473beb42780a7954341d90846fb5f7

See more details on using hashes here.

Provenance

The following attestation bundles were made for brickflowui-0.1.0-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