Skip to content

Commit d2a6ef7

Browse files
authored
[airflow] Add warning to airflow.datasets.DatasetEvent usage (AIR301) (#20551)
<!-- Thank you for contributing to Ruff/ty! 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? (Please prefix with `[ty]` for ty pull requests.) - Does this pull request include references to any relevant issues? --> ## Summary <!-- What's the purpose of the change? What does it do, and why? --> `airflow.datasets.DatasetEvent` has been removed in 3 but `AssetEvent` might be added in the future ## Test Plan <!-- How was it tested? --> update the test fixture and reorg in the second commit
1 parent 98d27c4 commit d2a6ef7

File tree

3 files changed

+133
-116
lines changed

3 files changed

+133
-116
lines changed

crates/ruff_linter/resources/test/fixtures/airflow/AIR301_names.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
)
1212
from airflow.api_connexion.security import requires_access
1313
from airflow.contrib.aws_athena_hook import AWSAthenaHook
14-
from airflow.datasets import DatasetAliasEvent
14+
from airflow.datasets import DatasetAliasEvent, DatasetEvent
1515
from airflow.operators.postgres_operator import Mapping
1616
from airflow.operators.subdag import SubDagOperator
1717
from airflow.secrets.cache import SecretCache
@@ -48,6 +48,7 @@
4848

4949
# airflow.datasets
5050
DatasetAliasEvent()
51+
DatasetEvent()
5152

5253

5354
# airflow.operators.subdag.*

crates/ruff_linter/src/rules/airflow/rules/removal_in_3.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,11 @@ fn check_name(checker: &Checker, expr: &Expr, range: TextRange) {
655655
},
656656
// airflow.datasets
657657
["airflow", "datasets", "DatasetAliasEvent"] => Replacement::None,
658+
["airflow", "datasets", "DatasetEvent"] => Replacement::Message(
659+
"`DatasetEvent` has been made private in Airflow 3. \
660+
Use `dict[str, Any]` for the time being. \
661+
An `AssetEvent` type will be added to the apache-airflow-task-sdk in a future version.",
662+
),
658663

659664
// airflow.hooks
660665
["airflow", "hooks", "base_hook", "BaseHook"] => Replacement::Rename {

0 commit comments

Comments
 (0)