Skip to content

Conversation

Lee-W
Copy link
Contributor

@Lee-W Lee-W commented Apr 2, 2025

Summary

As discussed in #14626 (comment), we're to separate suggested changes from required changes.

The following symbols has been moved to AIR312 from AIR302. They still work in Airflow 3.0, but they're suggested to be changed as they're expected to be removed in future version

from airflow.hooks.filesystem import FSHook
from airflow.hooks.package_index import PackageIndexHook
from airflow.hooks.subprocess import (SubprocessHook, SubprocessResult, working_directory)
from airflow.operators.bash import BashOperator
from airflow.operators.datetime import BranchDateTimeOperator, target_times_as_dates
from airflow.operators.trigger_dagrun import TriggerDagRunLink, TriggerDagRunOperator
from airflow.operators.empty import EmptyOperator
from airflow.operators.latest_only import LatestOnlyOperator
from airflow.operators.python import (BranchPythonOperator, PythonOperator, PythonVirtualenvOperator, ShortCircuitOperator)
from airflow.operators.weekday import BranchDayOfWeekOperator
from airflow.sensors.date_time import DateTimeSensor, DateTimeSensorAsync
from airflow.sensors.external_task import ExternalTaskMarker, ExternalTaskSensor, ExternalTaskSensorLink
from airflow.sensors.filesystem import FileSensor
from airflow.sensors.time_sensor import TimeSensor, TimeSensorAsync
from airflow.sensors.time_delta import TimeDeltaSensor, TimeDeltaSensorAsync, WaitSensor
from airflow.sensors.weekday import DayOfWeekSensor
from airflow.triggers.external_task import DagStateTrigger, WorkflowTrigger
from airflow.triggers.file import FileTrigger
from airflow.triggers.temporal import DateTimeTrigger, TimeDeltaTrigger

Test Plan

The test fixture has been updated acccordingly

@Lee-W Lee-W force-pushed the extract-suggested-AIR-changes branch from 43d5546 to d29c78c Compare April 3, 2025 03:01
@Lee-W Lee-W mentioned this pull request Apr 3, 2025
2 tasks
@ntBre ntBre self-assigned this Apr 3, 2025
@Lee-W Lee-W force-pushed the extract-suggested-AIR-changes branch from d29c78c to 32406e9 Compare April 8, 2025 14:21
@Lee-W Lee-W changed the title Extract suggested air changes [airflow] Extract AIR312 from AIR302 rules (AIR302, AIR312) Apr 8, 2025
@Lee-W Lee-W marked this pull request as ready for review April 8, 2025 14:23
@Lee-W Lee-W force-pushed the extract-suggested-AIR-changes branch from 06c47b8 to 5b1c7f6 Compare April 8, 2025 14:45
Copy link
Contributor

github-actions bot commented Apr 8, 2025

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

ℹ️ ecosystem check detected linter changes. (+13 -6 violations, +0 -0 fixes in 1 projects; 54 projects unchanged)

apache/airflow (+13 -6 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --no-fix --output-format concise --preview --select ALL

- airflow-core/tests/unit/utils/test_dot_renderer.py:103:22: AIR302 `airflow.operators.python.PythonOperator` is moved into `standard` provider in Airflow 3.0;
+ airflow-core/tests/unit/utils/test_dot_renderer.py:103:22: AIR312 `airflow.operators.python.PythonOperator` is deprecated and moved into `standard` provider in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version.
- airflow-core/tests/unit/utils/test_dot_renderer.py:83:22: AIR302 `airflow.operators.python.PythonOperator` is moved into `standard` provider in Airflow 3.0;
+ airflow-core/tests/unit/utils/test_dot_renderer.py:83:22: AIR312 `airflow.operators.python.PythonOperator` is deprecated and moved into `standard` provider in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version.
- performance/src/performance_dags/performance_dag/performance_dag.py:111:13: AIR302 `airflow.operators.python.PythonOperator` is moved into `standard` provider in Airflow 3.0;
+ performance/src/performance_dags/performance_dag/performance_dag.py:111:13: AIR312 `airflow.operators.python.PythonOperator` is deprecated and moved into `standard` provider in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version.
- performance/src/performance_dags/performance_dag/performance_dag.py:95:13: AIR302 `airflow.operators.bash.BashOperator` is moved into `standard` provider in Airflow 3.0;
+ performance/src/performance_dags/performance_dag/performance_dag.py:95:13: AIR312 `airflow.operators.bash.BashOperator` is deprecated and moved into `standard` provider in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version.
- providers/edge/src/airflow/providers/edge/example_dags/integration_test.py:116:24: AIR302 `airflow.operators.bash.BashOperator` is moved into `standard` provider in Airflow 3.0;
+ providers/edge/src/airflow/providers/edge/example_dags/integration_test.py:116:24: AIR312 `airflow.operators.bash.BashOperator` is deprecated and moved into `standard` provider in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version.
+ providers/tests/standard/utils/test_sensor_helper.py:162:17: AIR312 `airflow.operators.empty.EmptyOperator` is deprecated and moved into `standard` provider in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version.
+ providers/tests/standard/utils/test_sensor_helper.py:166:21: AIR312 `airflow.operators.empty.EmptyOperator` is deprecated and moved into `standard` provider in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version.
+ providers/tests/standard/utils/test_sensor_helper.py:194:21: AIR312 `airflow.operators.empty.EmptyOperator` is deprecated and moved into `standard` provider in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version.
+ providers/tests/standard/utils/test_sensor_helper.py:224:13: AIR312 `airflow.operators.empty.EmptyOperator` is deprecated and moved into `standard` provider in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version.
+ providers/tests/standard/utils/test_sensor_helper.py:257:13: AIR312 `airflow.operators.empty.EmptyOperator` is deprecated and moved into `standard` provider in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version.
+ providers/tests/standard/utils/test_sensor_helper.py:313:17: AIR312 `airflow.operators.empty.EmptyOperator` is deprecated and moved into `standard` provider in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version.
+ providers/tests/standard/utils/test_sensor_helper.py:377:21: AIR312 `airflow.operators.empty.EmptyOperator` is deprecated and moved into `standard` provider in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version.
- providers/ydb/tests/system/ydb/example_ydb.py:111:23: AIR302 `airflow.operators.python.PythonOperator` is moved into `standard` provider in Airflow 3.0;
+ providers/ydb/tests/system/ydb/example_ydb.py:111:23: AIR312 `airflow.operators.python.PythonOperator` is deprecated and moved into `standard` provider in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version.

Changes by rule (2 rules affected)

code total + violation - violation + fix - fix
AIR312 13 13 0 0 0
AIR302 6 0 6 0 0

Copy link
Contributor

@ntBre ntBre left a comment

Choose a reason for hiding this comment

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

Thanks! This looks good to me, just a few minor nits, mostly in the docs.

@Lee-W Lee-W force-pushed the extract-suggested-AIR-changes branch from a8166e6 to ab9aeb3 Compare April 9, 2025 02:22
@ntBre ntBre changed the title [airflow] Extract AIR312 from AIR302 rules (AIR302, AIR312) [airflow] Extract AIR312 from AIR302 rules (AIR302, AIR312) Apr 9, 2025
@ntBre ntBre added rule Implementing or modifying a lint rule preview Related to preview mode features labels Apr 9, 2025
@ntBre ntBre merged commit 7207c86 into astral-sh:main Apr 9, 2025
22 checks passed
dcreager added a commit that referenced this pull request Apr 9, 2025
* main:
  [red-knot] Allow explicit specialization of generic classes (#17023)
  [`airflow`] Refactor `AIR301` logic and fix typos (`AIR301`) (#17293)
  [`airflow`] Extract `AIR312` from `AIR302` rules (`AIR302`, `AIR312`) (#17152)
  [red-knot] Improve handling of visibility constraints in external modules when resolving `*` imports (#17286)
  [red-knot] Add more tests for `*` imports (#17315)
Glyphack pushed a commit to Glyphack/ruff that referenced this pull request Apr 9, 2025
…astral-sh#17152)

<!--
Thank you for contributing to Ruff! To help us out with reviewing,
please consider the following:

- Does this pull request include a summary of the change? (See below.)
- Does this pull request include a descriptive title?
- Does this pull request include references to any relevant issues?
-->

## Summary

<!-- What's the purpose of the change? What does it do, and why? -->

As discussed in
astral-sh#14626 (comment),
we're to separate suggested changes from required changes.

The following symbols has been moved to AIR312 from AIR302. They still
work in Airflow 3.0, but they're suggested to be changed as they're
expected to be removed in future version

```python
from airflow.hooks.filesystem import FSHook
from airflow.hooks.package_index import PackageIndexHook
from airflow.hooks.subprocess import (SubprocessHook, SubprocessResult, working_directory)
from airflow.operators.bash import BashOperator
from airflow.operators.datetime import BranchDateTimeOperator, target_times_as_dates
from airflow.operators.trigger_dagrun import TriggerDagRunLink, TriggerDagRunOperator
from airflow.operators.empty import EmptyOperator
from airflow.operators.latest_only import LatestOnlyOperator
from airflow.operators.python import (BranchPythonOperator, PythonOperator, PythonVirtualenvOperator, ShortCircuitOperator)
from airflow.operators.weekday import BranchDayOfWeekOperator
from airflow.sensors.date_time import DateTimeSensor, DateTimeSensorAsync
from airflow.sensors.external_task import ExternalTaskMarker, ExternalTaskSensor, ExternalTaskSensorLink
from airflow.sensors.filesystem import FileSensor
from airflow.sensors.time_sensor import TimeSensor, TimeSensorAsync
from airflow.sensors.time_delta import TimeDeltaSensor, TimeDeltaSensorAsync, WaitSensor
from airflow.sensors.weekday import DayOfWeekSensor
from airflow.triggers.external_task import DagStateTrigger, WorkflowTrigger
from airflow.triggers.file import FileTrigger
from airflow.triggers.temporal import DateTimeTrigger, TimeDeltaTrigger
```

## Test Plan

<!-- How was it tested? -->

The test fixture has been updated acccordingly

---------

Co-authored-by: Brent Westbrook <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
preview Related to preview mode features rule Implementing or modifying a lint rule
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants