diff --git a/acceptance/bundle/templates/default-python/classic/output/my_default_python/src/my_default_python/main.py b/acceptance/bundle/templates/default-python/classic/output/my_default_python/src/my_default_python/main.py index 1f9c88b322..1b1f380390 100644 --- a/acceptance/bundle/templates/default-python/classic/output/my_default_python/src/my_default_python/main.py +++ b/acceptance/bundle/templates/default-python/classic/output/my_default_python/src/my_default_python/main.py @@ -5,7 +5,9 @@ def main(): # Process command-line arguments - parser = argparse.ArgumentParser(description="Databricks job with catalog and schema parameters") + parser = argparse.ArgumentParser( + description="Databricks job with catalog and schema parameters", + ) parser.add_argument("--catalog", required=True) parser.add_argument("--schema", required=True) args = parser.parse_args() diff --git a/acceptance/bundle/templates/default-python/serverless/output/my_default_python/src/my_default_python/main.py b/acceptance/bundle/templates/default-python/serverless/output/my_default_python/src/my_default_python/main.py index 1f9c88b322..1b1f380390 100644 --- a/acceptance/bundle/templates/default-python/serverless/output/my_default_python/src/my_default_python/main.py +++ b/acceptance/bundle/templates/default-python/serverless/output/my_default_python/src/my_default_python/main.py @@ -5,7 +5,9 @@ def main(): # Process command-line arguments - parser = argparse.ArgumentParser(description="Databricks job with catalog and schema parameters") + parser = argparse.ArgumentParser( + description="Databricks job with catalog and schema parameters", + ) parser.add_argument("--catalog", required=True) parser.add_argument("--schema", required=True) args = parser.parse_args() diff --git a/acceptance/bundle/templates/pydabs/check-formatting/output.txt b/acceptance/bundle/templates/pydabs/check-formatting/output.txt index 660b212edd..c9b4edad76 100644 --- a/acceptance/bundle/templates/pydabs/check-formatting/output.txt +++ b/acceptance/bundle/templates/pydabs/check-formatting/output.txt @@ -11,9 +11,11 @@ Note that [DATABRICKS_URL] is used for initialization. ✨ Your new project has been created in the 'my_pydabs' directory! To get started, refer to the project README.md file and the documentation at https://docs.databricks.com/dev-tools/bundles/python/index.html. +Checking code formatting with ruff format --line-length 88 ->>> find my_pydabs -mindepth 1 ! -name pyproject.toml ! -regex .*/resources.* -delete +>>> ruff format --isolated --line-length 88 --quiet --diff --check my_pydabs +Checking code formatting with ruff format --line-length 120 ->>> ruff format --quiet --diff --check my_pydabs +>>> ruff format --isolated --line-length 120 --quiet --diff --check my_pydabs >>> yamlcheck.py diff --git a/acceptance/bundle/templates/pydabs/check-formatting/script b/acceptance/bundle/templates/pydabs/check-formatting/script index 540e84ceb7..03bd395cc3 100644 --- a/acceptance/bundle/templates/pydabs/check-formatting/script +++ b/acceptance/bundle/templates/pydabs/check-formatting/script @@ -2,10 +2,20 @@ envsubst < input.json.tmpl > input.json trace $CLI bundle init pydabs --config-file ./input.json -# only keep relevant files for snapshots -trace find my_pydabs -mindepth 1 ! -name 'pyproject.toml' ! -regex '.*/resources.*' -delete +# Use --isolated not to inherit ruff.toml in the repo root. +# +# Format both with line-length 88 to cover default formatter settings +# and 120 to cover default formatter settings in Workspace editor. +# +# You can use trailing comma to force line breaks to make formatting consistent +# with different line-length settings. + +echo "Checking code formatting with ruff format --line-length 88" +trace ruff format --isolated --line-length 88 --quiet --diff --check my_pydabs + +echo "Checking code formatting with ruff format --line-length 120" +trace ruff format --isolated --line-length 120 --quiet --diff --check my_pydabs -trace ruff format --quiet --diff --check my_pydabs trace yamlcheck.py rm -rf my_pydabs input.json diff --git a/libs/template/templates/default/template/{{.project_name}}/src/{{.project_name}}/main.py.tmpl b/libs/template/templates/default/template/{{.project_name}}/src/{{.project_name}}/main.py.tmpl index 2f8488bf36..ce6475f26e 100644 --- a/libs/template/templates/default/template/{{.project_name}}/src/{{.project_name}}/main.py.tmpl +++ b/libs/template/templates/default/template/{{.project_name}}/src/{{.project_name}}/main.py.tmpl @@ -5,7 +5,9 @@ from {{.project_name}} import taxis def main(): # Process command-line arguments - parser = argparse.ArgumentParser(description="Databricks job with catalog and schema parameters") + parser = argparse.ArgumentParser( + description="Databricks job with catalog and schema parameters", + ) parser.add_argument("--catalog", required=True) parser.add_argument("--schema", required=True) args = parser.parse_args()