Skip to content

Add global ruff linter; unify python/ onto repo-wide ruff#5726

Merged
denik merged 7 commits into
mainfrom
denik/python-checks
Jun 29, 2026
Merged

Add global ruff linter; unify python/ onto repo-wide ruff#5726
denik merged 7 commits into
mainfrom
denik/python-checks

Conversation

@denik

@denik denik commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Adds ruff check (linter) alongside the existing global ruff format. The enabled rule set (see ruff.toml) is intentionally conservative; opinionated/large-migration groups (pep8-naming, pyupgrade, simplify, pathlib, ...) are deferred to a follow-up.

What changed

  • Whole-repo lint: task lint now runs ruff check .. Excludes are split in ruff.toml: acceptance fixtures and template sources are lint-only excludes (still formatted); generated bundle init outputs, testdata, and tagging.py are excluded from both (they carry their own nested ruff config and don't need formatting). Run with --no-cache so ruff doesn't write .ruff_cache into checked-in fixture dirs.
  • python/ unification: the databricks-bundles package drops its own ruff lint config, dev dependency, and CI ruff step, relying on the global ruff. It keeps a minimal python/ruff.toml that extends the root but pins line-length = 88, so its formatting is unchanged.
  • CI: task lint now covers Python; the redundant standalone ruff-action format step is removed (formatting is still gated by task fmt + git diff).
  • Existing findings across the linted code are fixed (mostly autofixes).

This pull request and its description were written by Isaac.

@denik denik temporarily deployed to test-trigger-is June 25, 2026 15:04 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is June 25, 2026 15:04 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is June 25, 2026 15:06 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is June 25, 2026 15:06 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is June 25, 2026 15:21 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is June 25, 2026 15:21 — with GitHub Actions Inactive
@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

Integration test report

Commit: d558ecf

Run: 28366391318

Env 🟨​KNOWN 🔄​flaky 💚​RECOVERED 🙈​SKIP ✅​pass 🙈​skip Time
🟨​ aws linux 7 1 13 232 1036 4:40
🟨​ aws windows 7 1 13 234 1034 5:46
🔄​ aws-ucws linux 2 8 13 314 954 4:25
💚​ aws-ucws windows 8 13 318 952 3:14
💚​ azure linux 2 15 232 1035 3:31
💚​ azure windows 2 15 234 1033 2:44
💚​ azure-ucws linux 2 15 318 951 4:40
💚​ azure-ucws windows 2 15 320 949 2:59
💚​ gcp linux 2 15 231 1037 3:26
💚​ gcp windows 2 15 233 1035 2:59
23 interesting tests: 13 SKIP, 7 KNOWN, 2 flaky, 1 RECOVERED
Test Name aws linux aws windows aws-ucws linux aws-ucws windows azure linux azure windows azure-ucws linux azure-ucws windows gcp linux gcp windows
🟨​ TestAccept 🟨​K 🟨​K 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
🙈​ TestAccept/bundle/invariant/no_drift 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/permissions 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/with_permissions 🟨​K 🟨​K 💚​R 💚​R 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/with_permissions/DATABRICKS_BUNDLE_ENGINE=direct 🟨​K 🟨​K 💚​R 💚​R
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/with_permissions/DATABRICKS_BUNDLE_ENGINE=terraform 🟨​K 🟨​K 💚​R 💚​R
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions 🟨​K 🟨​K 💚​R 💚​R 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions/DATABRICKS_BUNDLE_ENGINE=direct 🟨​K 🟨​K 💚​R 💚​R
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions/DATABRICKS_BUNDLE_ENGINE=terraform 🟨​K 🟨​K 💚​R 💚​R
🙈​ TestAccept/bundle/resources/postgres_branches/basic 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_branches/recreate 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_branches/replace_existing 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_branches/update_protected 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_branches/without_branch_id 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_endpoints/basic 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_projects/update_display_name 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/synced_database_tables/basic 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_endpoints/drift/recreated_same_name 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_indexes/recreate/embedding_dimension 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/ssh/connection 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🔄​ TestFilerWorkspaceNotebook ✅​p ✅​p 🔄​f ✅​p ✅​p ✅​p ✅​p ✅​p ✅​p ✅​p
🔄​ TestFilerWorkspaceNotebook/sqlJupyterNotebook.ipynb ✅​p ✅​p 🔄​f ✅​p ✅​p ✅​p ✅​p ✅​p ✅​p ✅​p
💚​ TestFetchRepositoryInfoAPI_FromRepo 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
Top 1 slowest tests (at least 2 minutes):
duration env testname
2:02 gcp windows TestAccept

@denik denik temporarily deployed to test-trigger-is June 25, 2026 15:48 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is June 25, 2026 15:48 — with GitHub Actions Inactive
@denik denik force-pushed the denik/python-checks branch from c84f8a4 to 9c46636 Compare June 28, 2026 09:24
@denik denik temporarily deployed to test-trigger-is June 28, 2026 09:25 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is June 28, 2026 09:25 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is June 29, 2026 08:48 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is June 29, 2026 08:48 — with GitHub Actions Inactive
denik added 7 commits June 29, 2026 12:42
Adds `ruff check` (lint) alongside the existing `ruff format`, scoped to
first-party Python scripts via the `lint-python` task and wired into
`task lint`/`lint-q` and CI. The lint config lives in ruff.toml.

The python/databricks-bundles package drops its own ruff config, dev
dependency, and CI step and relies on the global ruff. As a result python/
is now formatted at the repo-wide line-length 120 (was the implicit 88).

Co-authored-by: Isaac
Add python/ruff.toml that extends the root config but overrides line-length
back to 88, so the databricks-bundles package keeps its own formatting while
inheriting the global lint rules. Regenerate the package so the committed
generated code matches codegen output under ruff 0.15.17.

Co-authored-by: Isaac
Adds python/docs, the acceptance infra scripts (install_terraform.py,
dbr_runner.py), and the permissions/user_agent test helper scripts to the
ruff lint scope, and fixes their findings (import sorting, exception
chaining, `is` type comparisons). dbr_runner.py ignores F821 (it is a DBR
notebook using the injected `spark`/`dbutils` globals).

Co-authored-by: Isaac
Switches `ruff check` from an explicit allowlist to whole-repo (`ruff check .`),
so first-party Python everywhere (cmd/, bundle/, internal/, libs/, integration/,
acceptance/bin, ...) is linted, not just a hand-maintained list.

Excludes are split by intent in ruff.toml:
- lint.exclude (lint-only; still formatted): acceptance fixtures, .py.tmpl
  template sources, the .vscode Pylance stub.
- extend-exclude (lint and format): generated `bundle init` outputs, testdata,
  and tagging.py. These must be pruned during traversal because they carry their
  own nested ruff config a lint-only exclude can't reach; formatting generated
  outputs is unnecessary anyway.

ruff check runs with --no-cache because some excluded fixtures carry their own
pyproject.toml/ruff.toml, and ruff would otherwise write a .ruff_cache into those
checked-in dirs and break the acceptance tests.

Co-authored-by: Isaac
@denik denik force-pushed the denik/python-checks branch from 7d0387e to d558ecf Compare June 29, 2026 10:43
@denik denik temporarily deployed to test-trigger-is June 29, 2026 10:44 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is June 29, 2026 10:44 — with GitHub Actions Inactive
- name: Run Go lint checks (does not include formatting checks)
- name: Run Go and Python lint checks (does not include formatting checks)
# `task lint` runs golangci-lint and `ruff check` (lint-python). ruff is
# provided by uvx, installed above; formatting is checked by `task fmt` below.

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.

Strictly speaking is not provided by uvx but installed on demand, right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, uvx downloads it when ran if not in its cache already.

Comment thread Taskfile.yml
# acceptance fixtures carry their own pyproject.toml/ruff.toml (config
# roots), so without it ruff writes a .ruff_cache into those checked-in
# dirs, polluting the goldens and breaking the acceptance tests.
- "{{.RUFF}} check --no-cache ."

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.

Is it possible to do this selectively?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

do what selectively? apply ruff to specific folder? or disable cache for specific folders?

@denik denik added this pull request to the merge queue Jun 29, 2026
Merged via the queue into main with commit 7669453 Jun 29, 2026
43 checks passed
@denik denik deleted the denik/python-checks branch June 29, 2026 14:20
@eng-dev-ecosystem-bot

Copy link
Copy Markdown
Collaborator

Integration test report

Commit: 7669453

Run: 28379000623

Env ❌​FAIL 🟨​KNOWN 🔄​flaky 💚​RECOVERED 🙈​SKIP ✅​pass 🙈​skip Time
🟨​ aws linux 7 1 13 232 1036 6:11
🟨​ aws windows 7 1 13 234 1034 6:25
💚​ aws-ucws linux 8 13 316 954 10:52
💚​ aws-ucws windows 8 13 318 952 5:43
💚​ azure linux 2 15 232 1035 6:05
💚​ azure windows 2 15 234 1033 3:29
❌​ azure-ucws linux 1 1 2 1 15 315 951 13:04
💚​ azure-ucws windows 2 15 320 949 7:46
💚​ gcp linux 2 15 231 1037 6:04
💚​ gcp windows 2 15 233 1035 2:52
24 interesting tests: 13 SKIP, 8 KNOWN, 2 flaky, 1 FAIL
Test Name aws linux aws windows aws-ucws linux aws-ucws windows azure linux azure windows azure-ucws linux azure-ucws windows gcp linux gcp windows
🟨​ TestAccept 🟨​K 🟨​K 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
🙈​ TestAccept/bundle/invariant/no_drift 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/permissions 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/with_permissions 🟨​K 🟨​K 💚​R 💚​R 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/with_permissions/DATABRICKS_BUNDLE_ENGINE=direct 🟨​K 🟨​K 💚​R 💚​R
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/with_permissions/DATABRICKS_BUNDLE_ENGINE=terraform 🟨​K 🟨​K 💚​R 💚​R
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions 🟨​K 🟨​K 💚​R 💚​R 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions/DATABRICKS_BUNDLE_ENGINE=direct 🟨​K 🟨​K 💚​R 💚​R
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions/DATABRICKS_BUNDLE_ENGINE=terraform 🟨​K 🟨​K 💚​R 💚​R
🙈​ TestAccept/bundle/resources/postgres_branches/basic 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_branches/recreate 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_branches/replace_existing 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_branches/update_protected 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_branches/without_branch_id 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_endpoints/basic 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_projects/update_display_name 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/synced_database_tables/basic 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_endpoints/drift/recreated_same_name 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_indexes/recreate/embedding_dimension 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/ssh/connection 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🔄​ TestSyncEnsureRemotePathIsUsableIfRepoExists ✅​p ✅​p ✅​p ✅​p ✅​p ✅​p 🔄​f ✅​p ✅​p ✅​p
🟨​ TestFetchRepositoryInfoAPI_FromRepo 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 🟨​K 💚​R 💚​R 💚​R
❌​ TestFetchRepositoryInfoAPI_FromRepo/root ✅​p ✅​p ✅​p ✅​p ✅​p ✅​p ❌​F ✅​p ✅​p ✅​p
🔄​ TestFetchRepositoryInfoAPI_FromRepo/subdir ✅​p ✅​p ✅​p ✅​p ✅​p ✅​p 🔄​f ✅​p ✅​p ✅​p
Top 4 slowest tests (at least 2 minutes):
duration env testname
3:03 azure-ucws linux TestAccept/bundle/generate/auto-bind/DATABRICKS_BUNDLE_ENGINE=terraform
2:34 aws-ucws windows TestAccept/bundle/deploy/mlops-stacks/DATABRICKS_BUNDLE_ENGINE=terraform
2:16 aws-ucws linux TestAccept/bundle/generate/auto-bind/DATABRICKS_BUNDLE_ENGINE=terraform
2:02 azure-ucws windows TestAccept

Sign up for free to 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.

3 participants