<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>article Setting up your development environment for Databricks Apps in Technical Blog</title>
    <link>https://community.databricks.com/t5/technical-blog/setting-up-your-development-environment-for-databricks-apps/ba-p/122111</link>
    <description>&lt;P&gt;&lt;EM&gt;This post is written by &lt;A href="https://www.linkedin.com/in/pascal-vogel/" target="_blank" rel="noopener"&gt;Pascal Vogel&lt;/A&gt;, Solutions Architect and &lt;A href="https://www.linkedin.com/in/asvlasov/" target="_blank" rel="noopener"&gt;Anton Vlasov&lt;/A&gt;, Senior Solutions Engineer.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.databricks.com/product/databricks-apps" target="_blank" rel="noopener"&gt;Databricks Apps&lt;/A&gt; makes it easy to build secure data and AI applications on the &lt;A href="https://www.databricks.com/product/data-intelligence-platform" target="_blank" rel="noopener"&gt;Databricks Data Intelligence Platform&lt;/A&gt;. To build great apps developers need more than a powerful platform - they need a great developer experience.&lt;/P&gt;
&lt;P&gt;If you're coming from notebook-based development, you might be missing out on the fast feedback loops, robust debugging tools, and seamless deployments that modern application developers take for granted.&lt;/P&gt;
&lt;P&gt;This post offers an opinionated guide to setting up a great developer experience for Databricks Apps with both the power of the Databricks platform and the productivity of using your favorite local integrated development environment (IDE).&lt;/P&gt;
&lt;H2&gt;Recognizing development anti-patterns&lt;/H2&gt;
&lt;P&gt;If you’re new to developing Python-based web applications and more used to implementing data pipelines and data science projects on Databricks, you may be tempted to start developing apps in a &lt;A href="https://docs.databricks.com/aws/en/notebooks/" target="_blank" rel="noopener"&gt;Databricks notebook&lt;/A&gt;, the &lt;A href="https://docs.databricks.com/aws/en/files/workspace" target="_blank" rel="noopener"&gt;workspace files&lt;/A&gt; UI, or using &lt;A href="https://docs.databricks.com/aws/en/dev-tools/databricks-connect/" target="_blank" rel="noopener"&gt;Databricks Connect&lt;/A&gt; from your local IDE.&lt;/P&gt;
&lt;P&gt;However, these approaches share several drawbacks which make them a bad fit for app development:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":cross_mark:"&gt;❌&lt;/span&gt; No live feedback loop: you need to redeploy your app each time you want to see changes in action.&lt;BR /&gt;&lt;span class="lia-unicode-emoji" title=":cross_mark:"&gt;❌&lt;/span&gt; Limited support for syntax highlighting, debugging, code linting, type checking, and unit testing.&lt;BR /&gt;&lt;span class="lia-unicode-emoji" title=":cross_mark:"&gt;❌&lt;/span&gt; Cumbersome dependency management to match the Databricks Apps environment.&lt;/P&gt;
&lt;P&gt;Instead, consider adopting the following best practices to develop applications for Databricks Apps.&lt;/P&gt;
&lt;H2&gt;Develop locally in your preferred IDE&lt;/H2&gt;
&lt;P&gt;To get a fast feedback loop when building Databricks Apps, develop on your local machine.&lt;/P&gt;
&lt;P&gt;Developing Databricks Apps does not require any service-specific tooling, so your favorite IDE like &lt;A href="https://code.visualstudio.com/" target="_blank" rel="noopener"&gt;Visual Studio Code&lt;/A&gt;, &lt;A href="https://www.jetbrains.com/pycharm/" target="_blank" rel="noopener"&gt;PyCharm&lt;/A&gt;, and others will work fine. AI-assisted IDEs like &lt;A href="https://www.cursor.com/" target="_blank" rel="noopener"&gt;Cursor&lt;/A&gt; or &lt;A href="https://windsurf.com/editor" target="_blank" rel="noopener"&gt;Windsurf&lt;/A&gt; are a great choice for developing Databricks Apps as well.&lt;/P&gt;
&lt;P&gt;Most Python application frameworks like &lt;A href="https://dash.plotly.com/" target="_blank" rel="noopener"&gt;Dash&lt;/A&gt;, &lt;A href="https://streamlit.io/" target="_blank" rel="noopener"&gt;Streamlit&lt;/A&gt;, or &lt;A href="https://flask.palletsprojects.com/en/stable/" target="_blank" rel="noopener"&gt;Flask&lt;/A&gt; feature live refresh functionality.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Live updates.gif" style="width: 800px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/17607i9866EC24133B3A94/image-size/large?v=v2&amp;amp;px=999" role="button" title="Live updates.gif" alt="Live updates.gif" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;In the case of Streamlit, make sure to enable “Always rerun” in the application UI or set the &lt;A href="https://docs.streamlit.io/develop/api-reference/configuration/config.toml#view-all-configuration-options" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;&lt;CODE class=" highlighter-rouge language-plaintext"&gt;runOnSave&lt;/CODE&gt;&lt;/SPAN&gt; configuration option&lt;/A&gt; to true. Dash and Flask have live refresh enabled out of the box.&lt;/P&gt;
&lt;P&gt;Optionally, you can improve your IDE development experience with extensions.&lt;/P&gt;
&lt;P&gt;The &lt;A href="https://docs.databricks.com/aws/en/dev-tools/vscode-ext/" target="_blank" rel="noopener"&gt;Databricks extension for Visual Studio Code&lt;/A&gt; makes it easy to &lt;A href="https://docs.databricks.com/aws/en/dev-tools/vscode-ext/bundles" target="_blank" rel="noopener"&gt;define, deploy, and run Databricks Asset Bundles (DABs)&lt;/A&gt; which allow you to apply CI/CD best practices to Databricks projects, including for apps. In addition, the extension allows you to sync files from your local machine to your Databricks workspace files from where you can easily deploy an app.&lt;/P&gt;
&lt;P&gt;The &lt;A href="https://www.jetbrains.com/help/pycharm/databricks.html" target="_blank" rel="noopener"&gt;Databricks PyCharm plugin&lt;/A&gt; similarly allows you to sync local files to your Databricks workspace.&lt;/P&gt;
&lt;H2&gt;Connect to live Databricks resources during development&lt;/H2&gt;
&lt;P&gt;Most Databricks Apps leverage other Databricks resources, such as &lt;A href="https://docs.databricks.com/aws/en/compute/sql-warehouse/" target="_blank" rel="noopener"&gt;SQL warehouses&lt;/A&gt;, &lt;A href="https://docs.databricks.com/aws/en/machine-learning/model-serving/" target="_blank" rel="noopener"&gt;Model Serving endpoints&lt;/A&gt;, or &lt;A href="https://docs.databricks.com/aws/en/jobs/" target="_blank" rel="noopener"&gt;Jobs&lt;/A&gt;. When developing apps locally, we recommend connecting directly to live Databricks resources running in a development workspace.&lt;/P&gt;
&lt;P&gt;This way, you always develop against live API definitions, rate limits, and other configurations that may be difficult to reproduce with mocked resources.&lt;/P&gt;
&lt;P&gt;By using &lt;A href="https://docs.databricks.com/aws/en/dev-tools/auth/oauth-u2m" target="_blank" rel="noopener"&gt;OAuth user-to-machine (U2M) authentication&lt;/A&gt;, your app running locally can interact with live Databricks resources using your personal Databricks credentials.&lt;/P&gt;
&lt;P&gt;With the &lt;A href="https://docs.databricks.com/aws/en/dev-tools/cli/" target="_blank" rel="noopener"&gt;Databricks CLI&lt;/A&gt; installed, run the following command to trigger the OAuth U2M authentication flow:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;databricks auth login --host &amp;lt;workspace-url&amp;gt; --profile DEFAULT&lt;/LI-CODE&gt;
&lt;P&gt;You can find &lt;A href="https://docs.databricks.com/aws/en/dev-tools/auth/oauth-u2m" target="_blank" rel="noopener"&gt;more detailed setup instructions in the Databricks documentation&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;Using this approach has two key benefits:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;You do not need to rely on long-lived credentials such as a &lt;A href="https://docs.databricks.com/aws/en/dev-tools/auth/pat" target="_self"&gt;Databricks Personal Access Token (PAT)&lt;/A&gt;.&lt;/LI&gt;
&lt;LI&gt;Your app can use the same code to interact with Databricks resources when running locally and when deployed on Databricks Apps.&lt;/LI&gt;
&lt;/OL&gt;
&lt;DIV style="background-color: #fff8c4; border: 1px solid #f1c40f; padding: 15px; border-radius: 8px; font-size: 0.95rem; color: #333; margin: 20px 0;"&gt;&lt;FONT size="3"&gt; &lt;STRONG&gt;Note:&lt;/STRONG&gt; In the context of developing or deploying a Databricks App, there is no situation where you would need to use a personal access token - OAuth is always the preferred authentication method.&lt;/FONT&gt;&lt;/DIV&gt;
&lt;P&gt;Consider the following example code which uses the &lt;A href="https://docs.databricks.com/aws/en/dev-tools/python-sql-connector" target="_blank" rel="noopener"&gt;Databricks SQL Connector&lt;/A&gt;:&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;# app.py

from databricks import sql
from databricks.sdk.core import Config

cfg = Config()

conn = sql.connect(
    server_hostname=cfg.host,
    http_path="&amp;lt;your-warehouse-http-path&amp;gt;",
    credentials_provider=lambda: cfg.authenticate,
)

query = f"SELECT * FROM main.sandbox.sales_customers LIMIT 1000"

with conn.cursor() as cursor:
    cursor.execute(query)
    df = cursor.fetchall_arrow().to_pandas()
    print(df.head())

conn.close()&lt;/LI-CODE&gt;
&lt;P&gt;This code works both when running the app locally when authenticated with OAuth U2M authentication and when using the service principal credentials of a Databricks App without any code changes.&lt;/P&gt;
&lt;P&gt;The same mechanism applies to the &lt;A href="https://databricks-sdk-py.readthedocs.io/en/latest/" target="_blank" rel="noopener"&gt;Databricks SDK&lt;/A&gt;:&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;# app.py

import streamlit as st
from databricks.sdk import WorkspaceClient
from databricks.sdk.service.serving import ChatMessage, ChatMessageRole

# Uses "default" Databricks CLI profile when running locally, but service principal credentials when deployed to Databricks Apps
w = WorkspaceClient()

response = w.serving_endpoints.query(
    name="databricks-llama-4-maverick",
    messages = [
        ChatMessage(
            role=ChatMessageRole.SYSTEM,
            content="You are a helpful assistant."
        ),
        ChatMessage(
            role=ChatMessageRole.USER,
            content="What is Databricks?",
        ),
    ]
)

st.json(response.as_dict())&lt;/LI-CODE&gt;
&lt;H2&gt;Set up the environment and manage dependencies&lt;/H2&gt;
&lt;P&gt;In a Databricks workspace, your Databricks App is deployed in a serverless compute environment with a certain Python version (currently 3.11.12) and selection of Python packages pre-installed. You can find a detailed list of pre-installed packages under &lt;A href="https://docs.databricks.com/aws/en/dev-tools/databricks-apps/dependencies#pre-installed-python-libraries" target="_blank" rel="noopener"&gt;Pre-installed Python libraries&lt;/A&gt; in the Databricks Apps docs.&lt;/P&gt;
&lt;P&gt;When developing locally, create a Python virtual environment and install any packages required by your application there.&lt;/P&gt;
&lt;P&gt;We recommend using &lt;A href="https://docs.astral.sh/uv/" target="_blank" rel="noopener"&gt;uv&lt;/A&gt; to manage virtual environments and dependencies.&lt;/P&gt;
&lt;P&gt;When deploying a Databricks App, the service looks for a &lt;SPAN&gt;&lt;CODE class=" highlighter-rouge language-plaintext"&gt;requirements.txt&lt;/CODE&gt;&lt;/SPAN&gt; file in the root directory of your application and installs any packages listed there. You can use the &lt;SPAN&gt;&lt;CODE class=" highlighter-rouge language-plaintext"&gt;requirements.txt&lt;/CODE&gt;&lt;/SPAN&gt; to install any additional packages or adjust the version of pre-installed packages. See &lt;A href="https://docs.databricks.com/aws/en/dev-tools/databricks-apps/dependencies" target="_blank" rel="noopener"&gt;Manage dependencies for a Databricks app&lt;/A&gt; for more information.&lt;/P&gt;
&lt;P&gt;Therefore, when preparing your app for deployment, export a list of all dependencies into a &lt;SPAN&gt;&lt;CODE class=" highlighter-rouge language-plaintext"&gt;requirements.txt&lt;/CODE&gt;&lt;/SPAN&gt; file. For example using uv:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;uv export --no-annotate --no-hashes --format requirements-txt &amp;gt; requirements.txt&lt;/LI-CODE&gt;
&lt;P&gt;Visit the &lt;EM&gt;Environment&lt;/EM&gt; tab in the Databricks Apps UI to see installed packages, Python version, and active environment variables:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SCR-20250509-jafk.png" style="width: 743px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/17608i8B6232C2EBE9D738/image-size/large?v=v2&amp;amp;px=999" role="button" title="SCR-20250509-jafk.png" alt="SCR-20250509-jafk.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;H2&gt;Simplify local app development with the run-local command&lt;/H2&gt;
&lt;P&gt;The &lt;A href="https://docs.databricks.com/aws/en/dev-tools/cli/" target="_blank" rel="noopener"&gt;Databricks CLI&lt;/A&gt; provides the &lt;A href="https://docs.databricks.com/aws/en/dev-tools/bundles/apps-tutorial#develop-and-debug-the-app-locally" target="_blank" rel="noopener"&gt;run-local&lt;/A&gt; command which simplifies dependency management, debugging, simulating HTTP headers, and injecting environment variables using the same configuration (&lt;SPAN&gt;&lt;CODE class=" highlighter-rouge language-plaintext"&gt;app.yaml&lt;/CODE&gt;&lt;/SPAN&gt; and &lt;SPAN&gt;&lt;CODE class=" highlighter-rouge language-plaintext"&gt;requirements.txt&lt;/CODE&gt;&lt;/SPAN&gt;) as the Databricks Apps service.&lt;/P&gt;
&lt;P&gt;The command orchestrates your local development environment by handling:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Configuration management&lt;/STRONG&gt;: the command reads your &lt;SPAN&gt;&lt;CODE class=" highlighter-rouge language-plaintext"&gt;app.yaml&lt;/CODE&gt;&lt;/SPAN&gt; file to determine how to start your app and what environment variables to set. You can also specify an alternative configuration file using the &lt;SPAN&gt;&lt;CODE class=" highlighter-rouge language-plaintext"&gt;--entrypoint&lt;/CODE&gt;&lt;/SPAN&gt; flag (e.g., &lt;SPAN&gt;&lt;CODE class=" highlighter-rouge language-plaintext"&gt;app-debug.yml&lt;/CODE&gt;&lt;/SPAN&gt; for debugging scenarios).&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Simulating HTTP headers&lt;/STRONG&gt;: a lightweight proxy runs locally to forward requests to your app while injecting Databricks-specific headers (prefixed with &lt;SPAN&gt;&lt;CODE class=" highlighter-rouge language-plaintext"&gt;X-*&lt;/CODE&gt;&lt;/SPAN&gt;) that your app would normally receive when deployed. This includes headers like &lt;SPAN&gt;&lt;CODE class=" highlighter-rouge language-plaintext"&gt;X-Forwarded-User&lt;/CODE&gt;&lt;/SPAN&gt; and &lt;SPAN&gt;&lt;CODE class=" highlighter-rouge language-plaintext"&gt;X-Forwarded-Email&lt;/CODE&gt;&lt;/SPAN&gt; that contain your authentication context.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Process management and authentication&lt;/STRONG&gt;: the command runs the start commands defined in your &lt;SPAN&gt;&lt;CODE class=" highlighter-rouge language-plaintext"&gt;app.yaml&lt;/CODE&gt;&lt;/SPAN&gt; file and automatically handles the authentication setup, ensuring your local app can seamlessly connect to live Databricks resources (like SQL warehouses and model serving endpoints) using your personal credentials without any code changes between the local and live Databricks environments.&lt;/P&gt;
&lt;P&gt;Run the command in your application root directory:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;databricks apps run-local&lt;/LI-CODE&gt;
&lt;P&gt;To specify a custom entrypoint file when running locally run:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;databricks apps run-local --entry-point app-debug.yaml&lt;/LI-CODE&gt;
&lt;P&gt;When deploying a Databricks App, any &lt;A href="https://docs.databricks.com/aws/en/dev-tools/databricks-apps/environment-variables" target="_blank" rel="noopener"&gt;environment variables defined in the &lt;SPAN&gt;&lt;CODE class=" highlighter-rouge language-plaintext"&gt;app.yaml&lt;/CODE&gt;&lt;/SPAN&gt; file&lt;/A&gt; will be injected into the Databricks Apps environment. Similarly, the run-local command automatically picks up any environment variables from your &lt;SPAN&gt;&lt;CODE class=" highlighter-rouge language-plaintext"&gt;app.yaml&lt;/CODE&gt;&lt;/SPAN&gt; when running locally.&lt;/P&gt;
&lt;P&gt;You can override environment variables present in your &lt;SPAN&gt;&lt;CODE class=" highlighter-rouge language-plaintext"&gt;app.yaml&lt;/CODE&gt;&lt;/SPAN&gt; or inject additional ones by running:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;databricks apps run-local --env DB_HOST=localhost&lt;/LI-CODE&gt;
&lt;P&gt;Run the following command to learn more about the available run-local options:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;databricks apps run-local --h&lt;/LI-CODE&gt;
&lt;P&gt;Under the hood, run-local leverages &lt;A href="https://docs.astral.sh/uv/" target="_blank" rel="noopener"&gt;uv&lt;/A&gt; and &lt;A href="https://github.com/microsoft/debugpy" target="_blank" rel="noopener"&gt;debugpy&lt;/A&gt;.&lt;/P&gt;
&lt;H2&gt;Deploy your Databricks Apps&lt;/H2&gt;
&lt;P&gt;During development, you may want to deploy your application to a live development workspace to test it.&lt;/P&gt;
&lt;P&gt;To deploy an application, the Databricks Apps service gets the application code from a folder in the Databricks workspace files.&lt;/P&gt;
&lt;P&gt;To copy your local application code to a workspace files folder, you can run the following command in the Databricks CLI:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;databricks sync . /Workspace/Users/user@example.com/my-app&lt;/LI-CODE&gt;
&lt;P&gt;Add the &lt;SPAN&gt;&lt;CODE class=" highlighter-rouge language-plaintext"&gt;--sync&lt;/CODE&gt;&lt;/SPAN&gt; option to continuously keep your local directory in sync with your Databricks workspace. &lt;SPAN&gt;The sync command excludes files from syncing based on a &lt;SPAN&gt;&lt;CODE class=" highlighter-rouge language-plaintext"&gt;.gitignore&lt;/CODE&gt;&lt;/SPAN&gt; file if present.&amp;nbsp;&lt;/SPAN&gt;Take a look at the &lt;A href="https://docs.databricks.com/aws/en/dev-tools/cli/sync-commands" target="_blank" rel="noopener"&gt;CLI documentation for the sync command group&lt;/A&gt; for details.&lt;/P&gt;
&lt;P&gt;Once the files are uploaded, create an app resource and deploy the app:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;# Run once to create the app compute resource
databricks apps create my-app

# Run for each deployment
databricks apps deploy my-app --source-code-path /Workspace/Users/user@example.com/my-app&lt;/LI-CODE&gt;
&lt;P&gt;Alternatively, you can use &lt;A href="https://docs.databricks.com/aws/en/dev-tools/bundles/" target="_blank" rel="noopener"&gt;Databricks Asset Bundles (DABs)&lt;/A&gt; to deploy your app from your local machine to different Databricks environments using the &lt;SPAN&gt;&lt;CODE class=" highlighter-rouge language-plaintext"&gt;databricks bundle deploy&lt;/CODE&gt;&lt;/SPAN&gt; and &lt;SPAN&gt;&lt;CODE class=" highlighter-rouge language-plaintext"&gt;databricks bundle run&lt;/CODE&gt;&lt;/SPAN&gt; commands.&lt;/P&gt;
&lt;P&gt;Take a look at &lt;A href="https://docs.databricks.com/aws/en/dev-tools/bundles/apps-tutorial" target="_blank" rel="noopener"&gt;Manage Databricks apps using Databricks Asset Bundles&lt;/A&gt; for detailed instructions.&lt;/P&gt;
&lt;P&gt;To set up a full CI/CD pipeline for Databricks Apps with DABs, take a look at &lt;A href="https://apps-cookbook.dev/blog/automate-apps-deployments-dabs" target="_blank" rel="noopener"&gt;Automate your Databricks Apps deployments with GitHub Actions and Databricks Asset Bundles&lt;/A&gt;.&lt;/P&gt;
&lt;H2&gt;Conclusion&lt;/H2&gt;
&lt;P&gt;Building great Databricks Apps starts with a great developer experience. By developing locally in your preferred IDE, using OAuth U2M authentication to connect to live resources, and leveraging tools like databricks apps run-local, you can achieve the fast feedback loops and seamless deployments that modern development demands.&lt;/P&gt;
&lt;P&gt;With this setup, you can focus on what matters most—building powerful data and AI applications on the Databricks platform.&lt;/P&gt;</description>
    <pubDate>Mon, 23 Jun 2025 19:36:59 GMT</pubDate>
    <dc:creator>pascal_vogel</dc:creator>
    <dc:date>2025-06-23T19:36:59Z</dc:date>
    <item>
      <title>Setting up your development environment for Databricks Apps</title>
      <link>https://community.databricks.com/t5/technical-blog/setting-up-your-development-environment-for-databricks-apps/ba-p/122111</link>
      <description>&lt;P&gt;&lt;EM&gt;This post is written by &lt;A href="https://www.linkedin.com/in/pascal-vogel/" target="_blank" rel="noopener"&gt;Pascal Vogel&lt;/A&gt;, Solutions Architect and &lt;A href="https://www.linkedin.com/in/asvlasov/" target="_blank" rel="noopener"&gt;Anton Vlasov&lt;/A&gt;, Senior Solutions Engineer.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.databricks.com/product/databricks-apps" target="_blank" rel="noopener"&gt;Databricks Apps&lt;/A&gt; makes it easy to build secure data and AI applications on the &lt;A href="https://www.databricks.com/product/data-intelligence-platform" target="_blank" rel="noopener"&gt;Databricks Data Intelligence Platform&lt;/A&gt;. To build great apps developers need more than a powerful platform - they need a great developer experience.&lt;/P&gt;
&lt;P&gt;If you're coming from notebook-based development, you might be missing out on the fast feedback loops, robust debugging tools, and seamless deployments that modern application developers take for granted.&lt;/P&gt;
&lt;P&gt;This post offers an opinionated guide to setting up a great developer experience for Databricks Apps with both the power of the Databricks platform and the productivity of using your favorite local integrated development environment (IDE).&lt;/P&gt;
&lt;H2&gt;Recognizing development anti-patterns&lt;/H2&gt;
&lt;P&gt;If you’re new to developing Python-based web applications and more used to implementing data pipelines and data science projects on Databricks, you may be tempted to start developing apps in a &lt;A href="https://docs.databricks.com/aws/en/notebooks/" target="_blank" rel="noopener"&gt;Databricks notebook&lt;/A&gt;, the &lt;A href="https://docs.databricks.com/aws/en/files/workspace" target="_blank" rel="noopener"&gt;workspace files&lt;/A&gt; UI, or using &lt;A href="https://docs.databricks.com/aws/en/dev-tools/databricks-connect/" target="_blank" rel="noopener"&gt;Databricks Connect&lt;/A&gt; from your local IDE.&lt;/P&gt;
&lt;P&gt;However, these approaches share several drawbacks which make them a bad fit for app development:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":cross_mark:"&gt;❌&lt;/span&gt; No live feedback loop: you need to redeploy your app each time you want to see changes in action.&lt;BR /&gt;&lt;span class="lia-unicode-emoji" title=":cross_mark:"&gt;❌&lt;/span&gt; Limited support for syntax highlighting, debugging, code linting, type checking, and unit testing.&lt;BR /&gt;&lt;span class="lia-unicode-emoji" title=":cross_mark:"&gt;❌&lt;/span&gt; Cumbersome dependency management to match the Databricks Apps environment.&lt;/P&gt;
&lt;P&gt;Instead, consider adopting the following best practices to develop applications for Databricks Apps.&lt;/P&gt;
&lt;H2&gt;Develop locally in your preferred IDE&lt;/H2&gt;
&lt;P&gt;To get a fast feedback loop when building Databricks Apps, develop on your local machine.&lt;/P&gt;
&lt;P&gt;Developing Databricks Apps does not require any service-specific tooling, so your favorite IDE like &lt;A href="https://code.visualstudio.com/" target="_blank" rel="noopener"&gt;Visual Studio Code&lt;/A&gt;, &lt;A href="https://www.jetbrains.com/pycharm/" target="_blank" rel="noopener"&gt;PyCharm&lt;/A&gt;, and others will work fine. AI-assisted IDEs like &lt;A href="https://www.cursor.com/" target="_blank" rel="noopener"&gt;Cursor&lt;/A&gt; or &lt;A href="https://windsurf.com/editor" target="_blank" rel="noopener"&gt;Windsurf&lt;/A&gt; are a great choice for developing Databricks Apps as well.&lt;/P&gt;
&lt;P&gt;Most Python application frameworks like &lt;A href="https://dash.plotly.com/" target="_blank" rel="noopener"&gt;Dash&lt;/A&gt;, &lt;A href="https://streamlit.io/" target="_blank" rel="noopener"&gt;Streamlit&lt;/A&gt;, or &lt;A href="https://flask.palletsprojects.com/en/stable/" target="_blank" rel="noopener"&gt;Flask&lt;/A&gt; feature live refresh functionality.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Live updates.gif" style="width: 800px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/17607i9866EC24133B3A94/image-size/large?v=v2&amp;amp;px=999" role="button" title="Live updates.gif" alt="Live updates.gif" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;In the case of Streamlit, make sure to enable “Always rerun” in the application UI or set the &lt;A href="https://docs.streamlit.io/develop/api-reference/configuration/config.toml#view-all-configuration-options" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;&lt;CODE class=" highlighter-rouge language-plaintext"&gt;runOnSave&lt;/CODE&gt;&lt;/SPAN&gt; configuration option&lt;/A&gt; to true. Dash and Flask have live refresh enabled out of the box.&lt;/P&gt;
&lt;P&gt;Optionally, you can improve your IDE development experience with extensions.&lt;/P&gt;
&lt;P&gt;The &lt;A href="https://docs.databricks.com/aws/en/dev-tools/vscode-ext/" target="_blank" rel="noopener"&gt;Databricks extension for Visual Studio Code&lt;/A&gt; makes it easy to &lt;A href="https://docs.databricks.com/aws/en/dev-tools/vscode-ext/bundles" target="_blank" rel="noopener"&gt;define, deploy, and run Databricks Asset Bundles (DABs)&lt;/A&gt; which allow you to apply CI/CD best practices to Databricks projects, including for apps. In addition, the extension allows you to sync files from your local machine to your Databricks workspace files from where you can easily deploy an app.&lt;/P&gt;
&lt;P&gt;The &lt;A href="https://www.jetbrains.com/help/pycharm/databricks.html" target="_blank" rel="noopener"&gt;Databricks PyCharm plugin&lt;/A&gt; similarly allows you to sync local files to your Databricks workspace.&lt;/P&gt;
&lt;H2&gt;Connect to live Databricks resources during development&lt;/H2&gt;
&lt;P&gt;Most Databricks Apps leverage other Databricks resources, such as &lt;A href="https://docs.databricks.com/aws/en/compute/sql-warehouse/" target="_blank" rel="noopener"&gt;SQL warehouses&lt;/A&gt;, &lt;A href="https://docs.databricks.com/aws/en/machine-learning/model-serving/" target="_blank" rel="noopener"&gt;Model Serving endpoints&lt;/A&gt;, or &lt;A href="https://docs.databricks.com/aws/en/jobs/" target="_blank" rel="noopener"&gt;Jobs&lt;/A&gt;. When developing apps locally, we recommend connecting directly to live Databricks resources running in a development workspace.&lt;/P&gt;
&lt;P&gt;This way, you always develop against live API definitions, rate limits, and other configurations that may be difficult to reproduce with mocked resources.&lt;/P&gt;
&lt;P&gt;By using &lt;A href="https://docs.databricks.com/aws/en/dev-tools/auth/oauth-u2m" target="_blank" rel="noopener"&gt;OAuth user-to-machine (U2M) authentication&lt;/A&gt;, your app running locally can interact with live Databricks resources using your personal Databricks credentials.&lt;/P&gt;
&lt;P&gt;With the &lt;A href="https://docs.databricks.com/aws/en/dev-tools/cli/" target="_blank" rel="noopener"&gt;Databricks CLI&lt;/A&gt; installed, run the following command to trigger the OAuth U2M authentication flow:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;databricks auth login --host &amp;lt;workspace-url&amp;gt; --profile DEFAULT&lt;/LI-CODE&gt;
&lt;P&gt;You can find &lt;A href="https://docs.databricks.com/aws/en/dev-tools/auth/oauth-u2m" target="_blank" rel="noopener"&gt;more detailed setup instructions in the Databricks documentation&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;Using this approach has two key benefits:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;You do not need to rely on long-lived credentials such as a &lt;A href="https://docs.databricks.com/aws/en/dev-tools/auth/pat" target="_self"&gt;Databricks Personal Access Token (PAT)&lt;/A&gt;.&lt;/LI&gt;
&lt;LI&gt;Your app can use the same code to interact with Databricks resources when running locally and when deployed on Databricks Apps.&lt;/LI&gt;
&lt;/OL&gt;
&lt;DIV style="background-color: #fff8c4; border: 1px solid #f1c40f; padding: 15px; border-radius: 8px; font-size: 0.95rem; color: #333; margin: 20px 0;"&gt;&lt;FONT size="3"&gt; &lt;STRONG&gt;Note:&lt;/STRONG&gt; In the context of developing or deploying a Databricks App, there is no situation where you would need to use a personal access token - OAuth is always the preferred authentication method.&lt;/FONT&gt;&lt;/DIV&gt;
&lt;P&gt;Consider the following example code which uses the &lt;A href="https://docs.databricks.com/aws/en/dev-tools/python-sql-connector" target="_blank" rel="noopener"&gt;Databricks SQL Connector&lt;/A&gt;:&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;# app.py

from databricks import sql
from databricks.sdk.core import Config

cfg = Config()

conn = sql.connect(
    server_hostname=cfg.host,
    http_path="&amp;lt;your-warehouse-http-path&amp;gt;",
    credentials_provider=lambda: cfg.authenticate,
)

query = f"SELECT * FROM main.sandbox.sales_customers LIMIT 1000"

with conn.cursor() as cursor:
    cursor.execute(query)
    df = cursor.fetchall_arrow().to_pandas()
    print(df.head())

conn.close()&lt;/LI-CODE&gt;
&lt;P&gt;This code works both when running the app locally when authenticated with OAuth U2M authentication and when using the service principal credentials of a Databricks App without any code changes.&lt;/P&gt;
&lt;P&gt;The same mechanism applies to the &lt;A href="https://databricks-sdk-py.readthedocs.io/en/latest/" target="_blank" rel="noopener"&gt;Databricks SDK&lt;/A&gt;:&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;# app.py

import streamlit as st
from databricks.sdk import WorkspaceClient
from databricks.sdk.service.serving import ChatMessage, ChatMessageRole

# Uses "default" Databricks CLI profile when running locally, but service principal credentials when deployed to Databricks Apps
w = WorkspaceClient()

response = w.serving_endpoints.query(
    name="databricks-llama-4-maverick",
    messages = [
        ChatMessage(
            role=ChatMessageRole.SYSTEM,
            content="You are a helpful assistant."
        ),
        ChatMessage(
            role=ChatMessageRole.USER,
            content="What is Databricks?",
        ),
    ]
)

st.json(response.as_dict())&lt;/LI-CODE&gt;
&lt;H2&gt;Set up the environment and manage dependencies&lt;/H2&gt;
&lt;P&gt;In a Databricks workspace, your Databricks App is deployed in a serverless compute environment with a certain Python version (currently 3.11.12) and selection of Python packages pre-installed. You can find a detailed list of pre-installed packages under &lt;A href="https://docs.databricks.com/aws/en/dev-tools/databricks-apps/dependencies#pre-installed-python-libraries" target="_blank" rel="noopener"&gt;Pre-installed Python libraries&lt;/A&gt; in the Databricks Apps docs.&lt;/P&gt;
&lt;P&gt;When developing locally, create a Python virtual environment and install any packages required by your application there.&lt;/P&gt;
&lt;P&gt;We recommend using &lt;A href="https://docs.astral.sh/uv/" target="_blank" rel="noopener"&gt;uv&lt;/A&gt; to manage virtual environments and dependencies.&lt;/P&gt;
&lt;P&gt;When deploying a Databricks App, the service looks for a &lt;SPAN&gt;&lt;CODE class=" highlighter-rouge language-plaintext"&gt;requirements.txt&lt;/CODE&gt;&lt;/SPAN&gt; file in the root directory of your application and installs any packages listed there. You can use the &lt;SPAN&gt;&lt;CODE class=" highlighter-rouge language-plaintext"&gt;requirements.txt&lt;/CODE&gt;&lt;/SPAN&gt; to install any additional packages or adjust the version of pre-installed packages. See &lt;A href="https://docs.databricks.com/aws/en/dev-tools/databricks-apps/dependencies" target="_blank" rel="noopener"&gt;Manage dependencies for a Databricks app&lt;/A&gt; for more information.&lt;/P&gt;
&lt;P&gt;Therefore, when preparing your app for deployment, export a list of all dependencies into a &lt;SPAN&gt;&lt;CODE class=" highlighter-rouge language-plaintext"&gt;requirements.txt&lt;/CODE&gt;&lt;/SPAN&gt; file. For example using uv:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;uv export --no-annotate --no-hashes --format requirements-txt &amp;gt; requirements.txt&lt;/LI-CODE&gt;
&lt;P&gt;Visit the &lt;EM&gt;Environment&lt;/EM&gt; tab in the Databricks Apps UI to see installed packages, Python version, and active environment variables:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SCR-20250509-jafk.png" style="width: 743px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/17608i8B6232C2EBE9D738/image-size/large?v=v2&amp;amp;px=999" role="button" title="SCR-20250509-jafk.png" alt="SCR-20250509-jafk.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;H2&gt;Simplify local app development with the run-local command&lt;/H2&gt;
&lt;P&gt;The &lt;A href="https://docs.databricks.com/aws/en/dev-tools/cli/" target="_blank" rel="noopener"&gt;Databricks CLI&lt;/A&gt; provides the &lt;A href="https://docs.databricks.com/aws/en/dev-tools/bundles/apps-tutorial#develop-and-debug-the-app-locally" target="_blank" rel="noopener"&gt;run-local&lt;/A&gt; command which simplifies dependency management, debugging, simulating HTTP headers, and injecting environment variables using the same configuration (&lt;SPAN&gt;&lt;CODE class=" highlighter-rouge language-plaintext"&gt;app.yaml&lt;/CODE&gt;&lt;/SPAN&gt; and &lt;SPAN&gt;&lt;CODE class=" highlighter-rouge language-plaintext"&gt;requirements.txt&lt;/CODE&gt;&lt;/SPAN&gt;) as the Databricks Apps service.&lt;/P&gt;
&lt;P&gt;The command orchestrates your local development environment by handling:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Configuration management&lt;/STRONG&gt;: the command reads your &lt;SPAN&gt;&lt;CODE class=" highlighter-rouge language-plaintext"&gt;app.yaml&lt;/CODE&gt;&lt;/SPAN&gt; file to determine how to start your app and what environment variables to set. You can also specify an alternative configuration file using the &lt;SPAN&gt;&lt;CODE class=" highlighter-rouge language-plaintext"&gt;--entrypoint&lt;/CODE&gt;&lt;/SPAN&gt; flag (e.g., &lt;SPAN&gt;&lt;CODE class=" highlighter-rouge language-plaintext"&gt;app-debug.yml&lt;/CODE&gt;&lt;/SPAN&gt; for debugging scenarios).&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Simulating HTTP headers&lt;/STRONG&gt;: a lightweight proxy runs locally to forward requests to your app while injecting Databricks-specific headers (prefixed with &lt;SPAN&gt;&lt;CODE class=" highlighter-rouge language-plaintext"&gt;X-*&lt;/CODE&gt;&lt;/SPAN&gt;) that your app would normally receive when deployed. This includes headers like &lt;SPAN&gt;&lt;CODE class=" highlighter-rouge language-plaintext"&gt;X-Forwarded-User&lt;/CODE&gt;&lt;/SPAN&gt; and &lt;SPAN&gt;&lt;CODE class=" highlighter-rouge language-plaintext"&gt;X-Forwarded-Email&lt;/CODE&gt;&lt;/SPAN&gt; that contain your authentication context.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Process management and authentication&lt;/STRONG&gt;: the command runs the start commands defined in your &lt;SPAN&gt;&lt;CODE class=" highlighter-rouge language-plaintext"&gt;app.yaml&lt;/CODE&gt;&lt;/SPAN&gt; file and automatically handles the authentication setup, ensuring your local app can seamlessly connect to live Databricks resources (like SQL warehouses and model serving endpoints) using your personal credentials without any code changes between the local and live Databricks environments.&lt;/P&gt;
&lt;P&gt;Run the command in your application root directory:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;databricks apps run-local&lt;/LI-CODE&gt;
&lt;P&gt;To specify a custom entrypoint file when running locally run:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;databricks apps run-local --entry-point app-debug.yaml&lt;/LI-CODE&gt;
&lt;P&gt;When deploying a Databricks App, any &lt;A href="https://docs.databricks.com/aws/en/dev-tools/databricks-apps/environment-variables" target="_blank" rel="noopener"&gt;environment variables defined in the &lt;SPAN&gt;&lt;CODE class=" highlighter-rouge language-plaintext"&gt;app.yaml&lt;/CODE&gt;&lt;/SPAN&gt; file&lt;/A&gt; will be injected into the Databricks Apps environment. Similarly, the run-local command automatically picks up any environment variables from your &lt;SPAN&gt;&lt;CODE class=" highlighter-rouge language-plaintext"&gt;app.yaml&lt;/CODE&gt;&lt;/SPAN&gt; when running locally.&lt;/P&gt;
&lt;P&gt;You can override environment variables present in your &lt;SPAN&gt;&lt;CODE class=" highlighter-rouge language-plaintext"&gt;app.yaml&lt;/CODE&gt;&lt;/SPAN&gt; or inject additional ones by running:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;databricks apps run-local --env DB_HOST=localhost&lt;/LI-CODE&gt;
&lt;P&gt;Run the following command to learn more about the available run-local options:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;databricks apps run-local --h&lt;/LI-CODE&gt;
&lt;P&gt;Under the hood, run-local leverages &lt;A href="https://docs.astral.sh/uv/" target="_blank" rel="noopener"&gt;uv&lt;/A&gt; and &lt;A href="https://github.com/microsoft/debugpy" target="_blank" rel="noopener"&gt;debugpy&lt;/A&gt;.&lt;/P&gt;
&lt;H2&gt;Deploy your Databricks Apps&lt;/H2&gt;
&lt;P&gt;During development, you may want to deploy your application to a live development workspace to test it.&lt;/P&gt;
&lt;P&gt;To deploy an application, the Databricks Apps service gets the application code from a folder in the Databricks workspace files.&lt;/P&gt;
&lt;P&gt;To copy your local application code to a workspace files folder, you can run the following command in the Databricks CLI:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;databricks sync . /Workspace/Users/user@example.com/my-app&lt;/LI-CODE&gt;
&lt;P&gt;Add the &lt;SPAN&gt;&lt;CODE class=" highlighter-rouge language-plaintext"&gt;--sync&lt;/CODE&gt;&lt;/SPAN&gt; option to continuously keep your local directory in sync with your Databricks workspace. &lt;SPAN&gt;The sync command excludes files from syncing based on a &lt;SPAN&gt;&lt;CODE class=" highlighter-rouge language-plaintext"&gt;.gitignore&lt;/CODE&gt;&lt;/SPAN&gt; file if present.&amp;nbsp;&lt;/SPAN&gt;Take a look at the &lt;A href="https://docs.databricks.com/aws/en/dev-tools/cli/sync-commands" target="_blank" rel="noopener"&gt;CLI documentation for the sync command group&lt;/A&gt; for details.&lt;/P&gt;
&lt;P&gt;Once the files are uploaded, create an app resource and deploy the app:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;# Run once to create the app compute resource
databricks apps create my-app

# Run for each deployment
databricks apps deploy my-app --source-code-path /Workspace/Users/user@example.com/my-app&lt;/LI-CODE&gt;
&lt;P&gt;Alternatively, you can use &lt;A href="https://docs.databricks.com/aws/en/dev-tools/bundles/" target="_blank" rel="noopener"&gt;Databricks Asset Bundles (DABs)&lt;/A&gt; to deploy your app from your local machine to different Databricks environments using the &lt;SPAN&gt;&lt;CODE class=" highlighter-rouge language-plaintext"&gt;databricks bundle deploy&lt;/CODE&gt;&lt;/SPAN&gt; and &lt;SPAN&gt;&lt;CODE class=" highlighter-rouge language-plaintext"&gt;databricks bundle run&lt;/CODE&gt;&lt;/SPAN&gt; commands.&lt;/P&gt;
&lt;P&gt;Take a look at &lt;A href="https://docs.databricks.com/aws/en/dev-tools/bundles/apps-tutorial" target="_blank" rel="noopener"&gt;Manage Databricks apps using Databricks Asset Bundles&lt;/A&gt; for detailed instructions.&lt;/P&gt;
&lt;P&gt;To set up a full CI/CD pipeline for Databricks Apps with DABs, take a look at &lt;A href="https://apps-cookbook.dev/blog/automate-apps-deployments-dabs" target="_blank" rel="noopener"&gt;Automate your Databricks Apps deployments with GitHub Actions and Databricks Asset Bundles&lt;/A&gt;.&lt;/P&gt;
&lt;H2&gt;Conclusion&lt;/H2&gt;
&lt;P&gt;Building great Databricks Apps starts with a great developer experience. By developing locally in your preferred IDE, using OAuth U2M authentication to connect to live resources, and leveraging tools like databricks apps run-local, you can achieve the fast feedback loops and seamless deployments that modern development demands.&lt;/P&gt;
&lt;P&gt;With this setup, you can focus on what matters most—building powerful data and AI applications on the Databricks platform.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jun 2025 19:36:59 GMT</pubDate>
      <guid>https://community.databricks.com/t5/technical-blog/setting-up-your-development-environment-for-databricks-apps/ba-p/122111</guid>
      <dc:creator>pascal_vogel</dc:creator>
      <dc:date>2025-06-23T19:36:59Z</dc:date>
    </item>
    <item>
      <title>Re: Setting up your development environment for Databricks Apps</title>
      <link>https://community.databricks.com/t5/technical-blog/setting-up-your-development-environment-for-databricks-apps/bc-p/122603#M659</link>
      <description>&lt;P&gt;Thanks for this post. Web based dev tools give one flexibility of performing the tasks from any machine/ anyplace.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Databricks Apps should also facilitate few ready templates to fast realise use cases like - agent UI, workflow app or any productivity app. That will further ease and help developers to follow the best practices.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jun 2025 04:35:26 GMT</pubDate>
      <guid>https://community.databricks.com/t5/technical-blog/setting-up-your-development-environment-for-databricks-apps/bc-p/122603#M659</guid>
      <dc:creator>akr</dc:creator>
      <dc:date>2025-06-24T04:35:26Z</dc:date>
    </item>
  </channel>
</rss>

