Skip to content

Commit 2df39fe

Browse files
Pass template name to README for templates that inherit from 'default' (#3893)
## Changes The default, default-python, pydabs, and lakeflow-pipelines templates now correctly display their template name in the generated README instead of always saying 'default template'. ## Why Showing the actual template name to customers seems helpful, even if it comes at the cost of a bit of extra code in the template. ## Tests Standard template acceptance tests
1 parent 2a07edc commit 2df39fe

File tree

8 files changed

+29
-5
lines changed

8 files changed

+29
-5
lines changed

acceptance/bundle/templates/default-python/classic/output/my_default_python/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# my_default_python
22

3-
The 'my_default_python' project was generated by using the default template.
3+
The 'my_default_python' project was generated by using the default-python template.
44

55
* `src/`: Python source code for this project.
66
* `src/my_default_python/`: Shared Python code that can be used by jobs and pipelines.

acceptance/bundle/templates/default-python/serverless/output/my_default_python/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# my_default_python
22

3-
The 'my_default_python' project was generated by using the default template.
3+
The 'my_default_python' project was generated by using the default-python template.
44

55
* `src/`: Python source code for this project.
66
* `src/my_default_python/`: Shared Python code that can be used by jobs and pipelines.

acceptance/bundle/templates/lakeflow-pipelines/python/output/my_lakeflow_pipelines/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# my_lakeflow_pipelines
22

3-
The 'my_lakeflow_pipelines' project was generated by using the default template.
3+
The 'my_lakeflow_pipelines' project was generated by using the lakeflow-pipelines template.
44

55
* `src/`: Python source code for this project.
66
* `resources/`: Resource configurations (jobs, pipelines, etc.)

acceptance/bundle/templates/lakeflow-pipelines/sql/output/my_lakeflow_pipelines/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# my_lakeflow_pipelines
22

3-
The 'my_lakeflow_pipelines' project was generated by using the default template.
3+
The 'my_lakeflow_pipelines' project was generated by using the lakeflow-pipelines template.
44

55
* `src/`: SQL source code for this project.
66
* `resources/`: Resource configurations (jobs, pipelines, etc.)

libs/template/templates/default-python/databricks_template_schema.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
"template_dir": "../default",
33
"welcome_message": "Welcome to the default Python template for Databricks Asset Bundles!\n\nAnswer the following questions to customize your project.\nYou can always change your configuration in the databricks.yml file later.\n\nNote that {{workspace_host}} is used for initialization.\n(For information on how to change your profile, see https://docs.databricks.com/dev-tools/cli/profiles.html.)",
44
"properties": {
5+
"template_name": {
6+
"//": "This property is always set to 'default-python'",
7+
"skip_prompt_if": {},
8+
"type": "string",
9+
"default": "default-python",
10+
"description": "Template name for documentation",
11+
"order": 0
12+
},
513
"project_name": {
614
"type": "string",
715
"default": "my_project",

libs/template/templates/default/template/{{.project_name}}/README.md.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
{{- $has_python_package_dir := and (or (eq .include_python "yes") (eq .include_job "yes") (eq .include_pipeline "yes")) (not (eq .lakeflow_only "yes"))}}
55
{{- $is_lakeflow := eq .lakeflow_only "yes"}}
66

7-
The '{{.project_name}}' project was generated by using the default template.
7+
The '{{.project_name}}' project was generated by using the {{.template_name}} template.
88

99
* `src/`: {{if eq .language "sql"}}SQL{{else}}Python{{end}} source code for this project.
1010
{{- if $has_python_package_dir}}

libs/template/templates/lakeflow-pipelines/databricks_template_schema.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
"template_dir": "../default",
33
"welcome_message": "Welcome to the template for Lakeflow Declarative Pipelines!\n\nPlease answer the below to tailor your project to your preferences.\nYou can always change your mind and change your configuration in the databricks.yml file later.\n\nNote that {{workspace_host}} is used for initialization\n(see https://docs.databricks.com/dev-tools/cli/profiles.html for how to change your profile).",
44
"properties": {
5+
"template_name": {
6+
"//": "This property is always set to 'lakeflow-pipelines'",
7+
"skip_prompt_if": {},
8+
"type": "string",
9+
"default": "lakeflow-pipelines",
10+
"description": "Template name for documentation",
11+
"order": -1
12+
},
513
"lakeflow_only": {
614
"//": "This property is set by default to adjust this template for Lakeflow Pipelines",
715
"skip_prompt_if": {},

libs/template/templates/pydabs/databricks_template_schema.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
"template_dir": "../default",
33
"welcome_message": "Welcome to PyDABs template for Databricks Asset Bundles!\n\nAnswer the following questions to customize your project.\nYou can always change your configuration in the databricks.yml file later.\n\nNote that {{workspace_host}} is used for initialization.\n(For information on how to change your profile, see https://docs.databricks.com/dev-tools/cli/profiles.html.)",
44
"properties": {
5+
"template_name": {
6+
"//": "This property is always set to 'pydabs'",
7+
"skip_prompt_if": {},
8+
"type": "string",
9+
"default": "pydabs",
10+
"description": "Template name for documentation",
11+
"order": 0
12+
},
513
"project_name": {
614
"type": "string",
715
"default": "my_project",

0 commit comments

Comments
 (0)