Skip to content

Commit e2fdfd9

Browse files
Add a language prompt to the default-minimal template (#3918)
## Changes This adds a language prompt (Python / SQL / other) to the `default-minimal` template. ## Why `pyproject.toml` and `conftest.py` are not relevant for non-Python DABs projects like Apps projects. ## Tests * Acceptance tests now exercise a non-Python minimal template --------- Co-authored-by: Claude <[email protected]>
1 parent 51281a1 commit e2fdfd9

File tree

9 files changed

+20
-189
lines changed

9 files changed

+20
-189
lines changed

NEXT_CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
### Dependency updates
1010

1111
### Bundles
12+
* Add a language prompt to the `default-minimal` template ([#3918](https://github.com/databricks/cli/pull/3918))
1213
* Add `default-scala` template for Scala projects with SBT build configuration and example code ([#3906](https://github.com/databricks/cli/pull/3906))
1314

1415
### API Changes
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
{
22
"project_name": "my_default_minimal",
3-
"include_job": "no",
4-
"include_pipeline": "no",
5-
"include_python": "no"
3+
"language_choice": "sql"
64
}

acceptance/bundle/templates/default-minimal/output/my_default_minimal/README.md

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,8 @@
22

33
The 'my_default_minimal' project was generated by using the default template.
44

5-
* `src/`: Python source code for this project.
5+
* `src/`: SQL source code for this project.
66
* `resources/`: Resource configurations (jobs, pipelines, etc.)
7-
* `tests/`: Unit tests for the shared Python code.
8-
* `fixtures/`: Fixtures for data sets (primarily used for testing).
9-
107

118
## Getting started
129

@@ -55,8 +52,3 @@ with this project. It's also possible to interact with it directly using the CLI
5552
```
5653
$ databricks bundle run
5754
```
58-
59-
5. Finally, to run tests locally, use `pytest`:
60-
```
61-
$ uv run pytest
62-
```

acceptance/bundle/templates/default-minimal/output/my_default_minimal/fixtures/.gitkeep

Lines changed: 0 additions & 9 deletions
This file was deleted.

acceptance/bundle/templates/default-minimal/output/my_default_minimal/pyproject.toml

Lines changed: 0 additions & 32 deletions
This file was deleted.

acceptance/bundle/templates/default-minimal/output/my_default_minimal/tests/conftest.py

Lines changed: 0 additions & 98 deletions
This file was deleted.

acceptance/bundle/templates/lakeflow-pipelines/sql/output/my_lakeflow_pipelines/pyproject.toml

Lines changed: 0 additions & 32 deletions
This file was deleted.

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

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,33 +64,40 @@
6464
],
6565
"order": 7
6666
},
67-
"language": {
68-
"//": "This property is always set to 'python' for default-minimal",
69-
"skip_prompt_if": {},
67+
"language_choice": {
7068
"type": "string",
7169
"default": "python",
7270
"description": "Initial language for this project",
7371
"enum": [
7472
"python",
75-
"sql"
73+
"sql",
74+
"other"
7675
],
7776
"order": 8
7877
},
78+
"language": {
79+
"//": "Derived from language_choice: for Python, pyproject.toml and tests are included; for others they are excluded",
80+
"skip_prompt_if": {},
81+
"type": "string",
82+
"default": "{{if eq .language_choice \"python\"}}python{{else}}sql{{end}}",
83+
"description": "Derived language property for template logic",
84+
"order": 9
85+
},
7986
"lakeflow_only": {
8087
"//": "This property is always set to 'no' for default-minimal",
8188
"skip_prompt_if": {},
8289
"type": "string",
8390
"default": "no",
8491
"description": "Internal flag for lakeflow-only templates",
85-
"order": 9
92+
"order": 10
8693
},
8794
"enable_pydabs": {
8895
"//": "This property is always set to 'no' for default-minimal",
8996
"skip_prompt_if": {},
9097
"type": "string",
9198
"default": "no",
9299
"description": "Use Python instead of YAML for resource definitions",
93-
"order": 10
100+
"order": 11
94101
}
95102
},
96103
"success_message": "\n✨ Your new project has been created in the '{{.project_name}}' directory!\n\nTo get started, refer to the project README.md file and the documentation at https://docs.databricks.com/dev-tools/bundles/index.html."

libs/template/templates/default/template/__preamble.tmpl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ This file only contains template directives; it is skipped for the actual output
4242
{{skip "{{.project_name}}/tests/sample_*.py"}}
4343
{{end}}
4444

45+
{{if $sql_language}}
46+
{{skip "{{.project_name}}/pyproject.toml"}}
47+
{{end}}
48+
4549
{{if $pydabs}}
4650
# When PyDABs is enabled, there is always resources/__init__.py and we don't need .gitkeep
4751
{{skip "{{.project_name}}/resources/.gitkeep"}}

0 commit comments

Comments
 (0)