[airflow] warning airflow....DAG.create_dagrun has been removed (AIR301)#21093
Conversation
|
| code | total | + violation | - violation | + fix | - fix |
|---|---|---|---|---|---|
| AIR311 | 224 | 224 | 0 | 0 | 0 |
| AIR301 | 3 | 3 | 0 | 0 | 0 |
Linter (preview)
ℹ️ ecosystem check detected linter changes. (+227 -0 violations, +0 -0 fixes in 1 projects; 54 projects unchanged)
apache/airflow (+227 -0 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --no-fix --output-format concise --preview --select ALL
+ airflow-core/src/airflow/cli/commands/dag_command.py:240:34: AIR311 `airflow.DAG` is removed in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version. + airflow-core/src/airflow/cli/commands/dag_command.py:388:32: AIR311 `airflow.DAG` is removed in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version. + airflow-core/src/airflow/cli/commands/dag_command.py:403:29: AIR311 `airflow.DAG` is removed in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version. + airflow-core/src/airflow/cli/commands/dag_command.py:413:46: AIR311 `airflow.DAG` is removed in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version. + airflow-core/src/airflow/cli/commands/dag_command.py:413:96: AIR311 `airflow.DAG` is removed in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version. + airflow-core/src/airflow/cli/commands/dag_command.py:547:30: AIR311 `airflow.DAG` is removed in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version. + airflow-core/src/airflow/cli/commands/dag_command.py:578:34: AIR311 `airflow.DAG` is removed in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version. + airflow-core/src/airflow/cli/commands/dag_command.py:616:25: AIR311 `airflow.DAG` is removed in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version. + airflow-core/src/airflow/dag_processing/dagbag.py:155:36: AIR311 `airflow.DAG` is removed in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version. + airflow-core/src/airflow/dag_processing/dagbag.py:245:30: AIR311 `airflow.DAG` is removed in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version. + airflow-core/src/airflow/dag_processing/dagbag.py:561:28: AIR311 `airflow.DAG` is removed in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version. + airflow-core/tests/integration/otel/dags/otel_test_dag.py:87:6: AIR311 `airflow.DAG` is removed in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version. + airflow-core/tests/integration/otel/dags/otel_test_dag_with_pause_between_tasks.py:152:6: AIR311 `airflow.DAG` is removed in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version. + airflow-core/tests/integration/otel/dags/otel_test_dag_with_pause_in_task.py:145:6: AIR311 `airflow.DAG` is removed 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/dag_processing/test_processor.py:541:11: AIR311 `airflow.DAG` is removed 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_db_cleanup.py:684:15: AIR311 `airflow.DAG` is removed in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version. + devel-common/src/tests_common/pytest_plugin.py:1251:24: AIR311 `airflow.DAG` is removed in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version. + devel-common/src/tests_common/pytest_plugin.py:2805:16: AIR311 `airflow.DAG` is removed 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:235:11: AIR311 `airflow.DAG` is removed in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version. + providers/airbyte/tests/system/airbyte/example_airbyte_trigger_job.py:33:6: AIR311 `airflow.DAG` is removed in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version. + providers/amazon/tests/unit/amazon/aws/operators/test_s3.py:651:15: AIR311 `airflow.DAG` is removed in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version. + providers/amazon/tests/unit/amazon/aws/transfers/test_base.py:42:20: AIR311 `airflow.DAG` is removed in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version. + providers/amazon/tests/unit/amazon/aws/transfers/test_dynamodb_to_s3.py:268:15: AIR311 `airflow.DAG` is removed in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version. + providers/apache/druid/tests/system/apache/druid/example_druid.py:31:6: AIR311 `airflow.DAG` is removed in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version. + providers/apache/flink/tests/unit/apache/flink/operators/test_flink_kubernetes.py:201:20: AIR311 `airflow.DAG` is removed in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version. + providers/apache/flink/tests/unit/apache/flink/sensors/test_flink_kubernetes.py:887:20: AIR311 `airflow.DAG` is removed in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version. ... 199 additional changes omitted for rule AIR311 + providers/openlineage/tests/unit/openlineage/plugins/test_listener.py:123:13: AIR301 `create_dagrun` is removed in Airflow 3.0 + providers/openlineage/tests/unit/openlineage/plugins/test_listener.py:966:13: AIR301 `create_dagrun` is removed in Airflow 3.0 + providers/openlineage/tests/unit/openlineage/utils/test_utils.py:1715:18: AIR301 `create_dagrun` is removed in Airflow 3.0 ... 198 additional changes omitted for project
Changes by rule (2 rules affected)
| code | total | + violation | - violation | + fix | - fix |
|---|---|---|---|---|---|
| AIR311 | 224 | 224 | 0 | 0 | 0 |
| AIR301 | 3 | 3 | 0 | 0 | 0 |
airflow] warning airflow....DAG.create_dagrun has been removed
airflow] warning airflow....DAG.create_dagrun has been removedairflow] warning airflow....DAG.create_dagrun has been removed (AIR301)
|
Now that the rule is stable, changes like this may need to be gated behind preview and go through our normal stabilization period. I think the change here is fine as it isn't a significant expansion of the rule's scope: |
| "collected_datasets" => Replacement::AttrName("collected_assets"), | ||
| _ => return, | ||
| }, | ||
| ["airflow", .., "DAG"] => match attr.as_str() { |
There was a problem hiding this comment.
Would it be better to be explicit from which module DAG was removed to avoid false positives instead of allowing any DAG symbol imported from anywhere within airflow (e.g. this also flags airflow.providers.my_provider.DAG)
There was a problem hiding this comment.
it's unlikely, but definiely better. Let me make the change.
There was a problem hiding this comment.
just updated. Thanks!
There was a problem hiding this comment.
Can you double-check if you pushed your most recent changes?
There was a problem hiding this comment.
Hi, sorry for the mess, it might be missed due to wrong rebasing. Just updated it and checked again. Thanks for reminder!
We had a discussion with @ntBre previously. Our conclusion back then was this kind of small ones are fine. But if we want to make it gated behind preview, what would be the process? Do we need to extract these logic to somewhere so that they can be activated through preview flag? Thanks! |
It should be pretty easy to add guards to the But I agree that this change seems fine without preview. |
|
Cool! This is super helpful! We might have some minor ones like this. Please let me know if any of them need to be in preview mode. Thank you! |
ed4bde9 to
7e08683
Compare
* origin/main: (21 commits) [ty] Update "constraint implication" relation to work on constraints between two typevars (#21068) [`flake8-type-checking`] Fix `TC003` false positive with `future-annotations` (#21125) [ty] Fix lookup of `__new__` on instances (#21147) Fix syntax error false positive on nested alternative patterns (#21104) [`pyupgrade`] Fix false positive for `TypeVar` with default on Python <3.13 (`UP046`,`UP047`) (#21045) [ty] Reachability and narrowing for enum methods (#21130) [ty] Use `range` instead of custom `IntIterable` (#21138) [`ruff`] Add support for additional eager conversion patterns (`RUF065`) (#20657) [`ruff-ecosystem`] Fix CLI crash on Python 3.14 (#21092) [ty] Infer type of `self` for decorated methods and properties (#21123) [`flake8-bandit`] Fix correct example for `S308` (#21128) [ty] Dont provide goto definition for definitions which are not reexported in builtins (#21127) [`airflow`] warning `airflow....DAG.create_dagrun` has been removed (`AIR301`) (#21093) [ty] follow the breaking API changes made in salsa-rs/salsa#1015 (#21117) [ty] Rename `Type::into_nominal_instance` (#21124) [ty] Filter out "unimported" from the current module [ty] Add evaluation test for auto-import including symbols in current module [ty] Refactor `ty_ide` completion tests [ty] Render `import <...>` in completions when "label details" isn't supported [`refurb`] Preserve digit separators in `Decimal` constructor (`FURB157`) (#20588) ...
Summary
airflow....DAG.create_dagrunhas been removedTest Plan
update accordingly and reorganize test cases