Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/fmt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: fmt

on:
pull_request:
types: [opened, synchronize]
merge_group:
types: [checks_requested]

jobs:
ruff:
runs-on:
group: databricks-protected-runner-group
labels: linux-ubuntu-latest

steps:
- name: Checkout repository and submodules
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Run ruff
uses: astral-sh/ruff-action@31a518504640beb4897d0b9f9e50a2a9196e75ba # v3.0.1
with:
version: "0.9.1"
args: "format --check"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.ruff_cache
8 changes: 8 additions & 0 deletions .ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[format]
exclude = [
# Templates are responsible for formatting at the source.
"dbt_sql/*",
"default_python/*",
"default_sql/*",
"mlops_stacks/*",
]
5 changes: 4 additions & 1 deletion contrib/data_engineering/scripts/add_asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@


def init_bundle(asset_type: AssetType) -> None:
cmd = f"databricks bundle init https://github.com/databricks/bundle-examples --template-dir contrib/templates/data-engineering/assets/{asset_type} " + " ".join(sys.argv[2:])
cmd = (
f"databricks bundle init https://github.com/databricks/bundle-examples --template-dir contrib/templates/data-engineering/assets/{asset_type} "
+ " ".join(sys.argv[2:])
)
subprocess.run(cmd, shell=True)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@


def init_bundle(asset_type: AssetType) -> None:
cmd = f"databricks bundle init https://github.com/databricks/bundle-examples --template-dir contrib/templates/data-engineering/assets/{asset_type} " + " ".join(sys.argv[2:])
cmd = (
f"databricks bundle init https://github.com/databricks/bundle-examples --template-dir contrib/templates/data-engineering/assets/{asset_type} "
+ " ".join(sys.argv[2:])
)
subprocess.run(cmd, shell=True)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
import pandas as pd

# Ensure environment variable is set correctly
assert os.getenv(
"DATABRICKS_WAREHOUSE_ID"
), "DATABRICKS_WAREHOUSE_ID must be set in app.yaml."
assert os.getenv("DATABRICKS_WAREHOUSE_ID"), (
"DATABRICKS_WAREHOUSE_ID must be set in app.yaml."
)


def sqlQuery(query: str) -> pd.DataFrame:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@
"""
Function to be called by [my_custom_wheel2].
"""


def hello():
cowsay.cow("Hello, world!")
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@
"""
Function that calls into [my_custom_wheel1].
"""


def hello():
my_custom_wheel1.hello()
2 changes: 1 addition & 1 deletion knowledge_base/job_with_multiple_wheels/src/call_wheel.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import my_custom_wheel2

if __name__ == '__main__':
if __name__ == "__main__":
my_custom_wheel2.hello()
4 changes: 2 additions & 2 deletions knowledge_base/private_wheel_packages/src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
# include an arbitrary wheel file in your bundle directory, deploy it, and use it from within your code.
import cowsay

if __name__ == '__main__':
cowsay.cow('Hello, world!')
if __name__ == "__main__":
cowsay.cow("Hello, world!")
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,7 @@
The value is the path to the function that is called when the command is run.
The key is referred to in the `python_wheel_task` section in `databricks.yml`.
"""


def hello():
cowsay.cow("Hello, world!")