Skip to content

Bump ruff to 0.16.0 and pin the base lint rule set - #70725

Merged
Lee-W merged 1 commit into
apache:mainfrom
astronomer:ruff-0-16-upgrade
Aug 7, 2026
Merged

Bump ruff to 0.16.0 and pin the base lint rule set#70725
Lee-W merged 1 commit into
apache:mainfrom
astronomer:ruff-0-16-upgrade

Conversation

@Lee-W

@Lee-W Lee-W commented Jul 30, 2026

Copy link
Copy Markdown
Member

Why

Ruff 0.16 widened its default rule set from ~250 to ~510 enabled rules. Airflow's config uses extend-select, which layers on top of whatever Ruff currently enables by default, so bumping the pin would have silently pulled in 261 unreviewed rules and produced sweeping autofix churn across the repo.

What

  • Pin select in pyproject.toml to the rule groups Airflow has always effectively had enabled (E4, E7, E9, F), so future Ruff releases cannot change the lint surface out from under us. Everything intentionally on is still listed in extend-select, unchanged.
  • Bump the pinned Ruff version to 0.16.0: .pre-commit-config.yaml, devel-common/pyproject.toml, and the two prek script headers (scripts/ci/prek/check_imports_in_providers.py, scripts/ci/prek/ruff_format.py).
  • Two rules fall newly in scope under the pin because they sit inside sections Airflow selects wholesale. Both are deferred via ignore rather than fixed here — a version bump should not also carry semantic changes, and each needs per-site judgement that deserves its own reviewed change:
    • ISC004 (implicit string concat in a collection literal) — 109 sites, unsafe autofix.
    • LOG004 (.exception() outside an exception handler) — 13 sites; each call site can only be classified by tracing whether an exception isgenuinely in flight there.
  • task-sdk/src/airflow/sdk/execution_time/schema/AGENTS.md: correct the bundle-registration snippet to match the actual get_bundle() / VersionBundle shape instead of a bare versions/__init__.py list.

Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.

@boring-cyborg boring-cyborg Bot added area:DAG-processing area:dev-tools area:providers area:task-sdk backport-to-v3-3-test Backport to v3-3-test provider:cncf-kubernetes Kubernetes (k8s) provider related issues provider:edge Edge Executor / Worker (AIP-69) / edge3 provider:google Google (including GCP) related issues labels Jul 30, 2026
@Lee-W
Lee-W force-pushed the ruff-0-16-upgrade branch 3 times, most recently from 3f90948 to 2943978 Compare August 5, 2026 06:40
@Lee-W
Lee-W marked this pull request as ready for review August 5, 2026 08:28
@Lee-W
Lee-W force-pushed the ruff-0-16-upgrade branch 2 times, most recently from a7c9359 to 81258ea Compare August 5, 2026 12:27
Ruff 0.16 widened its default rule set from ~250 to ~510 enabled rules.
Airflow's config uses extend-select, which layers on top of whatever Ruff
currently enables by default, so the bump would have silently pulled in 261
unreviewed rules and produced sweeping autofix churn across the repo. Pin
`select` to the rule groups Airflow has always effectively had enabled, so
future Ruff releases cannot change our lint surface out from under us;
everything intentionally on is still listed in extend-select as before.

Two rules remain newly in scope under the pin, because they sit inside
sections Airflow selects wholesale. Both are deferred behind `ignore` rather
than fixed here: a version bump should not also carry semantic changes, and
both need per-site judgement that deserves its own reviewed change. ISC004's
autofix is unsafe, and LOG004's call sites can only be classified by tracing
whether an exception is genuinely in flight at each one.

Ruff 0.16 also started formatting Python blocks inside Markdown, which is why
a task-sdk doc changes alongside the bump rather than in its own commit: its
example was a bare statement that the formatter rewrites into a one-element
tuple, which would have changed what the example teaches. Showing the entry
in its surrounding context keeps it both correct and stable to format.

The lockfile additionally picks up datamodel-code-generator 0.71.0. That is
not part of this change: apache#70670 raised the declared floor to >=0.71.0 without
regenerating uv.lock, leaving the lock pinned at a version its own constraint
excludes, so any `uv lock` has to correct it.
@Lee-W
Lee-W force-pushed the ruff-0-16-upgrade branch from 81258ea to 29e7df4 Compare August 6, 2026 06:59

@dheerajturaga dheerajturaga left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@Lee-W
Lee-W merged commit 858df99 into apache:main Aug 7, 2026
303 checks passed
@Lee-W
Lee-W deleted the ruff-0-16-upgrade branch August 7, 2026 01:32
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Backport failed to create: v3-3-test. View the failure log Run details

Note: As of Merging PRs targeted for Airflow 3.X
the committer who merges the PR is responsible for backporting the PRs that are bug fixes (generally speaking) to the maintenance branches.

In matter of doubt please ask in #release-management Slack channel.

Status Branch Result
v3-3-test Commit Link

You can attempt to backport this manually by running:

cherry_picker 858df99 v3-3-test

This should apply the commit to the v3-3-test branch and leave the commit in conflict state marking
the files that need manual conflict resolution.

After you have resolved the conflicts, you can continue the backport process by running:

cherry_picker --continue

If you don't have cherry-picker installed, see the installation guide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:DAG-processing area:dev-tools area:providers area:task-sdk backport-to-v3-3-test Backport to v3-3-test provider:cncf-kubernetes Kubernetes (k8s) provider related issues provider:edge Edge Executor / Worker (AIP-69) / edge3 provider:google Google (including GCP) related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants