Skip to content

Update the default-python template according to Lakeflow conventions - #3712

Merged
lennartkats-db merged 25 commits into
mainfrom
replace-default-python-template
Nov 4, 2025
Merged

Update the default-python template according to Lakeflow conventions#3712
lennartkats-db merged 25 commits into
mainfrom
replace-default-python-template

Conversation

@lennartkats-db

@lennartkats-dblennartkats-db commented Oct 3, 2025

Copy link
Copy Markdown
Contributor

Changes

This updates the default-python template according to the latest Lakeflow conventions as established in #3671. Notably, the new template moves away from the use of notebooks for pipeline source code.

The new layout looks as follows when the user selects they want both the sample job and the sample pipeline:

📁 resources
├── sample_job.job.yml
└── sample_etl.pipeline.yml
📁 src
├── 📁 my_project — shared source code for use in jobs and/or pipelines
│ ├── __init__.py
│ └── main.py
└── 📁 my_project_etl — source code for the sample_etl pipeline
├── __init__.py
├── 📁 transformations
│ ├── __init__.py
│ ├── sample_zones_my_project.py
│ └── sample_trips_my_project.py
├── 📁 explorations — exploratory notebooks
│ ├── __init__.py
│ └── sample_exploration.ipynb
└── README.md
📁 tests — unit tests
📁 fixtures — fixtures (these can now be used with load_fixture)
databricks.yml
pyproject.toml
README.md

The template prompts have been updated to cater to this structure. Notably, they include a new prompt to manage the catalog and schema used by the template. These settings are propagated to both the job and the pipeline:

Welcome to the default Python template for Databricks Asset Bundles!
Answer the following questions to customize your project.
You can always change your configuration in the databricks.yml file later.
Note that https://e2-dogfood.staging.cloud.databricks.com is used for initialization.
(For information on how to change your profile, see https://docs.databricks.com/dev-tools/cli/profiles.html.)
Unique name for this project [my_project]: my_project
Include a Lakeflow job that runs a notebook: yes
Include an ETL pipeline: yes
Include a sample Python package that builds into a wheel file: yes
Use serverless compute: yes
Default catalog for any tables created by this project [main]: main
Use a personal schema for each user working on this project.
(This is recommended. Your personal schema will be 'main.lennart_kats'.): yes
✨ Your new project has been created in the 'my_project' directory!
To get started, refer to the project README.md file and the documentation at https://docs.databricks.com/dev-tools/bundles/index.html.

Testing

@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Oct 3, 2025

Copy link
Copy Markdown
Collaborator

Run: 19064653887

Env🔄​flaky💚​RECOVERED🙈​SKIP✅​pass🙈​skip
💚​aws linux11326591
💚​aws windows11327590
💚​aws-ucws linux11449486
💚​aws-ucws windows11450485
💚​azure linux11326590
💚​azure windows11327589
💚​azure-ucws linux11445485
💚​azure-ucws windows11446484
🔄​gcp linux811317592
🔄​gcp windows211324591
12 failing tests:
Test Nameaws linuxaws windowsaws-ucws linuxaws-ucws windowsazure linuxazure windowsazure-ucws linuxazure-ucws windowsgcp linuxgcp windows
TestAccept💚​R💚​R💚​R💚​R💚​R💚​R💚​R💚​R💚​R💚​R
TestAccept/bundle/resources/jobs/fail-on-active-runs✅​p✅​p✅​p✅​p✅​p✅​p✅​p✅​p🔄​f✅​p
TestAccept/bundle/resources/jobs/fail-on-active-runs/DATABRICKS_BUNDLE_ENGINE=direct✅​p✅​p✅​p✅​p✅​p✅​p✅​p✅​p🔄​f✅​p
TestAccept/bundle/resources/pipelines/lakeflow-pipeline✅​p✅​p✅​p✅​p✅​p✅​p✅​p✅​p🔄​f✅​p
TestAccept/bundle/resources/pipelines/lakeflow-pipeline/DATABRICKS_BUNDLE_ENGINE=terraform✅​p✅​p✅​p✅​p✅​p✅​p✅​p✅​p🔄​f✅​p
TestAccept/bundle/resources/pipelines/update/DATABRICKS_BUNDLE_ENGINE=direct✅​p✅​p✅​p✅​p✅​p✅​p✅​p✅​p🔄​f✅​p
TestAccept/bundle/resources/pipelines/update/DATABRICKS_BUNDLE_ENGINE=terraform✅​p✅​p✅​p✅​p✅​p✅​p✅​p✅​p🔄​f✅​p
TestAccept/bundle/run/app-with-job🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S
TestAccept/bundle/templates/default-python/combinations/classic/DATABRICKS_BUNDLE_ENGINE=terraform/DLT=no/NBOOK=no/PY=yes✅​p✅​p✅​p✅​p✅​p✅​p✅​p✅​p🔄​f✅​p
TestAccept/bundle/templates/default-python/combinations/classic/DATABRICKS_BUNDLE_ENGINE=terraform/DLT=yes/NBOOK=no/PY=no✅​p✅​p✅​p✅​p✅​p✅​p✅​p✅​p🔄​f✅​p
TestAccept/bundle/templates/default-python/integration_classic/DATABRICKS_BUNDLE_ENGINE=direct/UV_PYTHON=3.10✅​p✅​p✅​p✅​p✅​p✅​p✅​p✅​p✅​p🔄​f
TestAccept/bundle/templates/default-python/integration_classic/DATABRICKS_BUNDLE_ENGINE=terraform/UV_PYTHON=3.9✅​p✅​p✅​p✅​p✅​p✅​p✅​p✅​p✅​p🔄​f

@lennartkats-db
lennartkats-dbforce-pushed the replace-default-python-template branch from 7415181 to 7b37662CompareOctober 6, 2025 19:37
@lennartkats-db
lennartkats-dbforce-pushed the replace-default-python-template branch from 2a8ea44 to 81371f2CompareOctober 7, 2025 12:29
Base automatically changed from add-default-template to mainOctober 13, 2025 08:09
@lennartkats-db
lennartkats-dbforce-pushed the replace-default-python-template branch from ba4fa01 to 603fe28CompareOctober 13, 2025 11:48
lennartkats-db added a commit that referenced this pull request Oct 16, 2025
Modernize the cli-pipelines template to follow the same conventions as the
lakeflow-pipelines template (from PR #3712), while keeping transformations/
in the project root.
Key changes:
- Add pyproject.toml with modern Python project configuration
- Add editable install via environment.dependencies in pipeline config
- Add artifacts_dynamic_version preset for development
- Simplify databricks.yml with clearer variable descriptions
- Fix VS Code settings extraPaths to point to actual directories
- Add library/versions.tmpl for reusable template definitions
The template now supports edit mode for better development experience
while maintaining compatibility with both Python and SQL variations.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
lennartkats-db added a commit that referenced this pull request Oct 16, 2025
Modernize the cli-pipelines template to follow the same conventions as the
lakeflow-pipelines template (from PR #3712), while keeping transformations/
in the project root.
Key changes:
- Add pyproject.toml with modern Python project configuration
- Add editable install via environment.dependencies in pipeline config
- Add artifacts_dynamic_version preset for development
- Simplify databricks.yml with clearer variable descriptions
- Fix VS Code settings extraPaths to point to actual directories
- Add library/versions.tmpl for reusable template definitions
The template now supports edit mode for better development experience
while maintaining compatibility with both Python and SQL variations.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
lennartkats-db added a commit that referenced this pull request Oct 16, 2025
Modernize the cli-pipelines template to follow the same conventions as the
lakeflow-pipelines template (from PR #3712), while keeping transformations/
in the project root.
Key changes:
- Add pyproject.toml with modern Python project configuration
- Add editable install via environment.dependencies in pipeline config
- Add artifacts_dynamic_version preset for development
- Simplify databricks.yml with clearer variable descriptions
- Fix VS Code settings extraPaths to point to actual directories
- Add library/versions.tmpl for reusable template definitions
The template now supports edit mode for better development experience
while maintaining compatibility with both Python and SQL variations.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
lennartkats-db added a commit that referenced this pull request Oct 16, 2025
Modernize the cli-pipelines template to follow the same conventions as the
lakeflow-pipelines template (from PR #3712), while keeping transformations/
in the project root.
Key changes:
- Add pyproject.toml with modern Python project configuration
- Add editable install via environment.dependencies in pipeline config
- Add artifacts_dynamic_version preset for development
- Simplify databricks.yml with clearer variable descriptions
- Fix VS Code settings extraPaths to point to actual directories
- Add library/versions.tmpl for reusable template definitions
The template now supports edit mode for better development experience
while maintaining compatibility with both Python and SQL variations.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
lennartkats-db added a commit that referenced this pull request Oct 16, 2025
Modernize the cli-pipelines template to follow the same conventions as the
lakeflow-pipelines template (from PR #3712), while keeping transformations/
in the project root.
Key changes:
- Add pyproject.toml with modern Python project configuration
- Add editable install via environment.dependencies in pipeline config
- Add artifacts_dynamic_version preset for development
- Simplify databricks.yml with clearer variable descriptions
- Fix VS Code settings extraPaths to point to actual directories
- Add library/versions.tmpl for reusable template definitions
The template now supports edit mode for better development experience
while maintaining compatibility with both Python and SQL variations.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>

@fjakobsfjakobs left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me

lennartkats-dband others added 6 commits November 2, 2025 20:23
Remove unused files (default-python now depends on ../default!)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
…n-template
# Conflicts:
#	NEXT_CHANGELOG.md
#	acceptance/auth/bundle_and_profile/output.txt
#	acceptance/bundle/templates/default-python/classic/out.plan_prod.direct.json
#	acceptance/bundle/templates/default-python/integration_classic/output.txt
#	acceptance/bundle/templates/lakeflow-pipelines/python/output/my_lakeflow_pipelines/resources/lakeflow_pipelines_etl.pipeline.yml
#	acceptance/bundle/templates/lakeflow-pipelines/python/output/my_lakeflow_pipelines/resources/my_lakeflow_pipelines_etl.pipeline.yml
#	acceptance/bundle/templates/lakeflow-pipelines/python/output/my_lakeflow_pipelines/src/lakeflow_pipelines_etl/README.md
#	acceptance/bundle/templates/lakeflow-pipelines/python/output/my_lakeflow_pipelines/src/my_lakeflow_pipelines_etl/README.md
#	acceptance/bundle/templates/lakeflow-pipelines/sql/output/my_lakeflow_pipelines/resources/lakeflow_pipelines_etl.pipeline.yml
#	acceptance/bundle/templates/lakeflow-pipelines/sql/output/my_lakeflow_pipelines/resources/my_lakeflow_pipelines_etl.pipeline.yml
#	acceptance/bundle/templates/lakeflow-pipelines/sql/output/my_lakeflow_pipelines/src/lakeflow_pipelines_etl/README.md
#	acceptance/bundle/templates/lakeflow-pipelines/sql/output/my_lakeflow_pipelines/src/my_lakeflow_pipelines_etl/README.md
#	libs/template/template.go
#	libs/template/templates/default/template/__preamble.tmpl
#	libs/template/templates/experimental-default-python-vnext/databricks_template_schema.json
#	libs/template/templates/lakeflow-pipelines/databricks_template_schema.json
…ibility
This commit applies several critical fixes to the template system:
1. Non-UC workspace support (deeeb38): Set default_catalog to "hive_metastore"
when no UC metastore is available, ensuring templates work on non-UC workspaces.
Applied to default-python and lakeflow-pipelines templates.
2. Fix catalog property references (63758b4): Changed template conditionals from
using the helper function `default_catalog` to the property `.default_catalog`
in pipeline templates. This ensures proper evaluation of the user-provided value.
3. Serverless catalog field (0088b28): Always emit the catalog field for serverless
pipelines, changing the comment to clarify that "Serverless compute requires
Unity Catalog". Applied to both YAML and Python pipeline templates.
4. PyDABs compatibility: Added missing enable_pydabs property to default-python
template schema to support the merged PyDABs infrastructure from main.
Acceptance test outputs have been updated to reflect these changes.
Comment thread.gitignore Outdated
Comment thread.gitignore Outdated
lennartkats-dband others added 3 commits November 4, 2025 09:16
Integration tests were failing because when a UC workspace has no
metastore default catalog, the template would use "hive_metastore"
for serverless pipelines, which the API rejects.
Hardcode 'catalog: main' instead of '${var.catalog}' for this case.
This provides a clear error if "main" doesn't exist and matches the
approach used in origin/main.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@lennartkats-db@eng-dev-ecosystem-bot@pietern@fjakobs@juliacrawf-db