Skip to content

ruff: move per-file-ignores into inline noqa headers#1457

Open
hectorcast-db wants to merge 1 commit into
mainfrom
hectorcastejon/inline-noqa
Open

ruff: move per-file-ignores into inline noqa headers#1457
hectorcast-db wants to merge 1 commit into
mainfrom
hectorcastejon/inline-noqa

Conversation

@hectorcast-db
Copy link
Copy Markdown
Contributor

@hectorcast-db hectorcast-db commented Jun 1, 2026

Why

Internal coding guidelines don't allow the centralized [tool.ruff.lint.per-file-ignores] block in pyproject.toml. Exceptions must be annotated inline on the files that need them. Most of the affected files are generated, so the noqa headers have to come from the codegen templates.

What

Removes the [tool.ruff.lint.per-file-ignores] block from pyproject.toml and replaces it with inline # ruff: noqa: <codes> headers on the affected files.

Where the noqas come from

File set Codes Source
databricks/sdk/__init__.py F401 F403 F405 F811 codegen template (pysdkv0/templates/batch/init.py.tmpl)
databricks/sdk/service/*.py + tests/databricks/sdk/service/*.py F811 F841 codegen template (pysdkv0/templates/packages/service.py.tmpl)
databricks/sdk/errors/overrides.py F403 F405 codegen template (pysdkv0/templates/batch/error_overrides.py.tmpl)
tests/generated/test_*.py F403 F405 codegen template (pysdkv0/unittestgen/{http,lro,marshall,idempotency})
databricks/sdk/core.py F403 F405 hand-written (star-imports for backwards compat)
databricks/sdk/errors/__init__.py F401 F403 F405 F811 hand-written (public re-export surface)
databricks/sdk/logger/__init__.py F401 hand-written (re-exports RoundTrip)
databricks/sdk/runtime/__init__.py line 127 F401 hand-written (intentional optional import probe)

F401 stays uncovered on service/*.py on purpose: make fmt runs ruff check --fix-only to strip the fat-import header emitted by the codegen template. Ignoring F401 there would defeat that (the autoflake-equivalent behavior the SDK relies on).

Paired PR

Template changes land in databricks-eng/universe#2008679. Regenerate via bazel build //openapi/genkit then genkit update-sdk --dir . from this checkout. Generation job runs once a day, so the two PRs are safe to merge outside of that window.

Verification

$ make lint
uv run ruff check databricks tests
All checks passed!
uv run ruff format --check databricks tests
152 files already formatted

This pull request and its description were written by Isaac.

NO_CHANGELOG=true

Replaces the centralized `[tool.ruff.lint.per-file-ignores]` block
in pyproject.toml with inline `# ruff: noqa: <codes>` headers on the
affected files. Matches the team's direction away from
per-file-ignores.

Generated files (databricks/sdk/__init__.py, service/*.py,
errors/overrides.py, tests/databricks/sdk/service/*.py,
tests/generated/*.py) get their headers from the codegen templates;
re-run `genkit update-sdk` to regenerate. The matching template
changes live in the universe PR.

Hand-written changes:
- core.py: `# ruff: noqa: F403, F405` for the star imports that
  re-export config and credentials_provider for backward compat.
- errors/__init__.py: `# ruff: noqa: F401, F403, F405, F811` for
  the public re-export surface.
- logger/__init__.py: `# ruff: noqa: F401` (re-exports RoundTrip).
- runtime/__init__.py: `# noqa: F401` on the optional
  `from pyspark.sql.functions import udf` (intentionally probes
  availability inside a try/except).

`make lint` passes cleanly.
@hectorcast-db hectorcast-db deployed to test-trigger-is June 1, 2026 06:44 — with GitHub Actions Active
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 1, 2026

If integration tests don't run automatically, an authorized user can run them manually by following the instructions below:

Trigger:
go/deco-tests-run/sdk-py

Inputs:

  • PR number: 1457
  • Commit SHA: 09be803480bb63ee51e2264ae10bf7945d847611

Checks will be approved automatically on success.

@hectorcast-db hectorcast-db requested review from Divyansh-db and mihaimitrea-db and removed request for Divyansh-db June 1, 2026 06:49
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.

1 participant