Token导航 LogoToken导航TokenDH.com
前端设计敏感数据github未标认证来源可访问许可证需确认审计通过

databricks-app-pythondatabricks 应用 Python

Agent Skill

用于辅助 Python 项目开发、测试、依赖管理和常见框架工作流。它适合让 Agent 阅读 Python 代码、定位测试问题、整理运行命令、生成脚本或分析数据处理逻辑。使用时需要确认项目虚拟环境、依赖版本和测试入口;涉及执行脚本、读写文件、访问数据库或调用外部 API 时,应先明确运行目录和输入输出范围,避免误改生产数据。

总安装

485

周安装

20

GitHub Stars

1,332

下载量

158
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:databricks-app-python(databricks 应用 Python)
来源仓库:https://github.com/databricks-solutions/ai-dev-kit
仓库路径:skills/databricks-app-python
安装命令:
npx skills add https://github.com/databricks-solutions/ai-dev-kit --skill databricks-app-python
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/databricks-solutions/ai-dev-kit --skill databricks-app-python

简介

构建基于 Python 的 Databricks 应用程序。

  • 支持 Dash、Streamlit、Flask 等多种框架选择。
  • 使用 SDK Config() 认证并避免硬编码凭证。
  • 推荐 Gunicorn 部署 Flask,uvicorn 部署 FastAPI。
  • 需通过 app.yaml 注入资源配置防止信息泄露。databricks-app-python 属于前端设计类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Databricks Python Application

Build Python-based Databricks applications. For full examples and recipes, see the Databricks Apps Cookbook.


Critical Rules (always follow)

  • MUST confirm framework choice or use Framework Selection below
  • MUST use SDK Config() for authentication (never hardcode tokens)
  • MUST use app.yaml valueFrom for resources (never hardcode resource IDs)
  • MUST use dash-bootstrap-components for Dash app layout and styling
  • MUST use @st.cache_resource for Streamlit database connections
  • MUST deploy Flask with Gunicorn, FastAPI with uvicorn (not dev servers)

Required Steps

Copy this checklist and verify each item:

- [ ] Framework selected
- [ ] Auth strategy decided: app auth, user auth, or both
- [ ] App resources identified (SQL warehouse, Lakebase, serving endpoint, etc.)
- [ ] Backend data strategy decided (SQL warehouse, Lakebase, or SDK)
- [ ] Deployment method: CLI or DABs

Framework Selection

FrameworkBest Forapp.yaml Command
DashProduction dashboards, BI tools, complex interactivity["python", "app.py"]
StreamlitRapid prototyping, data science apps, internal tools["streamlit", "run", "app.py"]
GradioML demos, model interfaces, chat UIs["python", "app.py"]
FlaskCustom REST APIs, lightweight apps, webhooks["gunicorn", "app:app", "-w", "4", "-b", "0.0.0.0:8000"]
FastAPIAsync APIs, auto-generated OpenAPI docs["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]
ReflexFull-stack Python apps without JavaScript["reflex", "run", "--env", "prod"]

Default: Recommend Streamlit for prototypes, Dash for production dashboards, FastAPI for APIs, Gradio for ML demos.


Quick Reference

ConceptDetails
RuntimePython 3.11, Ubuntu 22.04, 2 vCPU, 6 GB RAM
Pre-installedDash 2.18.1, Streamlit 1.38.0, Gradio 4.44.0, Flask 3.0.3, FastAPI 0.115.0
Auth (app)Service principal via Config() — auto-injected DATABRICKS_CLIENT_ID/DATABRICKS_CLIENT_SECRET
Auth (user)x-forwarded-access-token header — see 1-authorization.md
ResourcesvalueFrom in app.yaml — see 2-app-resources.md
Cookbookhttps://apps-cookbook.dev/
Docshttps://docs.databricks.com/aws/en/dev-tools/databricks-apps/

Detailed Guides

Authorization: Use 1-authorization.md when configuring app or user authorization — covers service principal auth, on-behalf-of user tokens, OAuth scopes, and per-framework code examples. (Keywords: OAuth, service principal, user auth, on-behalf-of, access token, scopes)

App resources: Use 2-app-resources.md when connecting your app to Databricks resources — covers SQL warehouses, Lakebase, model serving, secrets, volumes, and the valueFrom pattern. (Keywords: resources, valueFrom, SQL warehouse, model serving, secrets, volumes, connections)

Frameworks: See 3-frameworks.md for Databricks-specific patterns per framework — covers Dash, Streamlit, Gradio, Flask, FastAPI, and Reflex with auth integration, deployment commands, and Cookbook links. (Keywords: Dash, Streamlit, Gradio, Flask, FastAPI, Reflex, framework selection)

Deployment: Use 4-deployment.md when deploying your app — covers Databricks CLI, Asset Bundles (DABs), app.yaml configuration, and post-deployment verification. (Keywords: deploy, CLI, DABs, asset bundles, app.yaml, logs)

Lakebase: Use 5-lakebase.md when using Lakebase (PostgreSQL) as your app's data layer — covers auto-injected env vars, psycopg2/asyncpg patterns, and when to choose Lakebase vs SQL warehouse. (Keywords: Lakebase, PostgreSQL, psycopg2, asyncpg, transactional, PGHOST)

MCP tools: Use 6-mcp-approach.md for managing app lifecycle via MCP tools — covers creating, deploying, monitoring, and deleting apps programmatically. (Keywords: MCP, create app, deploy app, app logs)

Foundation Models: See examples/llm_config.py for calling Databricks foundation model APIs — covers OAuth M2M auth, OpenAI-compatible client wiring, and token caching. (Keywords: foundation model, LLM, OpenAI client, chat completions)


Workflow

  1. Determine the task type: New app from scratch? → Use Framework Selection, then read 3-frameworks.md Setting up authorization? → Read 1-authorization.md Connecting to data/resources? → Read 2-app-resources.md Using Lakebase (PostgreSQL)? → Read 5-lakebase.md Deploying to Databricks? → Read 4-deployment.md Using MCP tools? → Read 6-mcp-approach.md Calling foundation model/LLM APIs? → See examples/llm_config.py
  2. Follow the instructions in the relevant guide
  3. For full code examples, browse https://apps-cookbook.dev/

Core Architecture

All Python Databricks apps follow this pattern:

app-directory/
├── app.py                 # Main application (or framework-specific name)
├── models.py              # Pydantic data models
├── backend.py             # Data access layer
├── requirements.txt       # Additional Python dependencies
├── app.yaml               # Databricks Apps configuration
└── README.md

Backend Toggle Pattern

import os
from databricks.sdk.core import Config

USE_MOCK = os.getenv("USE_MOCK_BACKEND", "true").lower() == "true"

if USE_MOCK:
    from backend_mock import MockBackend as Backend
else:
    from backend_real import RealBackend as Backend

backend = Backend()

SQL Warehouse Connection (shared across all frameworks)

from databricks.sdk.core import Config
from databricks import sql

cfg = Config()  # Auto-detects credentials from environment
conn = sql.connect(
    server_hostname=cfg.host,
    http_path=f"/sql/1.0/warehouses/{os.getenv('DATABRICKS_WAREHOUSE_ID')}",
    credentials_provider=lambda: cfg.authenticate,
)

Pydantic Models

from pydantic import BaseModel, Field
from datetime import datetime
from enum import Enum

class Status(str, Enum):
    ACTIVE = "active"
    PENDING = "pending"

class EntityOut(BaseModel):
    id: str
    name: str
    status: Status
    created_at: datetime

class EntityIn(BaseModel):
    name: str = Field(..., min_length=1)
    status: Status = Status.PENDING

Common Issues

IssueSolution
Connection exhaustedUse @st.cache_resource (Streamlit) or connection pooling
Auth token not foundCheck x-forwarded-access-token header — only available when deployed, not locally
App won't startCheck app.yaml command matches framework; check databricks apps logs <name>
Resource not accessibleAdd resource via UI, verify SP has permissions, use valueFrom in app.yaml
Import error on deployAdd missing packages to requirements.txt (pre-installed packages don't need listing)
Lakebase app crashes on startpsycopg2/asyncpg are NOT pre-installed — MUST add to requirements.txt
Port conflictApps must bind to DATABRICKS_APP_PORT env var (defaults to 8000). Never use 8080. Streamlit is auto-configured; for others, read the env var in code or use 8000 in app.yaml command
Streamlit: set_page_config errorst.set_page_config() must be the first Streamlit command
Dash: unstyled layoutAdd dash-bootstrap-components; use dbc.themes.BOOTSTRAP
Slow queriesUse Lakebase for transactional/low-latency; SQL warehouse for analytical queries

Platform Constraints

ConstraintDetails
RuntimePython 3.11, Ubuntu 22.04 LTS
Compute2 vCPUs, 6 GB memory (default)
Pre-installed frameworksDash, Streamlit, Gradio, Flask, FastAPI, Shiny
Custom packagesAdd to requirements.txt in app root
NetworkApps can reach Databricks APIs; external access depends on workspace config
User authPublic Preview — workspace admin must enable before adding scopes

Official Documentation

Related Skills

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

34.68%
按下载量换算55

Claude

30%
按下载量换算47

Cursor

17.89%
按下载量换算28

Gemini CLI

8.78%
按下载量换算14

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills