Skip to content

[airflow] Extract AIR311 from AIR301 rules (AIR301, AIR311) #17310

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Apr 16, 2025

Conversation

Lee-W
Copy link
Contributor

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

Summary

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

The following symbols have been moved to AIR311 from AIR301. They still work in Airflow 3.0, but they're suggested to be changed as they're expected to be removed in a future version.

  • arguments
    • airflow..DAG | dag
      • sla_miss_callback
    • operators
      • sla
  • name
    • airflow.Dataset] | [airflow.datasets.Datasetairflow.sdk.Asset
    • airflow.datasets, rest @ ..
      • DatasetAliasairflow.sdk.AssetAlias
      • DatasetAllairflow.sdk.AssetAll
      • DatasetAnyairflow.sdk.AssetAny
      • expand_alias_to_datasetsairflow.sdk.expand_alias_to_assets
      • metadata.Metadataairflow.sdk.Metadata
    • airflow.models.baseoperator.chainairflow.sdk.chain
    • airflow.models.baseoperator.chain_linearairflow.sdk.chain_linear
    • airflow.models.baseoperator.cross_downstreamairflow.sdk.cross_downstream
    • airflow.models.baseoperatorlink.BaseOperatorLinkairflow.sdk.definitions.baseoperatorlink.BaseOperatorLink
    • airflow.timetables, rest @ ..
      • datasets.DatasetOrTimeSchedule → * airflow.timetables.assets.AssetOrTimeSchedule
    • airflow.utils, rest @ ..
      • dag_parsing_context.get_parsing_contextairflow.sdk.get_parsing_context

Test Plan

The test fixture has been updated acccordingly

@Lee-W Lee-W changed the title Extract air301 to air311 feat(AIR311): move suggested changes to AIR311 Apr 9, 2025
@Lee-W Lee-W force-pushed the extract-AIR301-to-AIR311 branch 2 times, most recently from 7ced201 to c0271b6 Compare April 10, 2025 15:23
@Lee-W Lee-W changed the title feat(AIR311): move suggested changes to AIR311 [airflow] Extract AIR311 from AIR301 rules (AIR301, AIR311) Apr 10, 2025
@Lee-W Lee-W marked this pull request as ready for review April 10, 2025 15:35
Copy link
Contributor

github-actions bot commented Apr 10, 2025

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

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

apache/airflow (+134 -134 violations, +0 -0 fixes)

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

- providers/amazon/tests/system/amazon/aws/example_appflow.py:102:5: AIR301 `airflow.models.baseoperator.chain` is removed in Airflow 3.0
+ providers/amazon/tests/system/amazon/aws/example_appflow.py:102:5: AIR311 `airflow.models.baseoperator.chain` 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/system/amazon/aws/example_appflow_run.py:182:5: AIR301 `airflow.models.baseoperator.chain` is removed in Airflow 3.0
+ providers/amazon/tests/system/amazon/aws/example_appflow_run.py:182:5: AIR311 `airflow.models.baseoperator.chain` 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/system/amazon/aws/example_athena.py:159:5: AIR301 `airflow.models.baseoperator.chain` is removed in Airflow 3.0
+ providers/amazon/tests/system/amazon/aws/example_athena.py:159:5: AIR311 `airflow.models.baseoperator.chain` 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/system/amazon/aws/example_azure_blob_to_s3.py:65:5: AIR301 `airflow.models.baseoperator.chain` is removed in Airflow 3.0
+ providers/amazon/tests/system/amazon/aws/example_azure_blob_to_s3.py:65:5: AIR311 `airflow.models.baseoperator.chain` 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/system/amazon/aws/example_batch.py:258:5: AIR301 `airflow.models.baseoperator.chain` is removed in Airflow 3.0
+ providers/amazon/tests/system/amazon/aws/example_batch.py:258:5: AIR311 `airflow.models.baseoperator.chain` 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/system/amazon/aws/example_bedrock.py:108:5: AIR301 `airflow.models.baseoperator.chain` is removed in Airflow 3.0
+ providers/amazon/tests/system/amazon/aws/example_bedrock.py:108:5: AIR311 `airflow.models.baseoperator.chain` 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/system/amazon/aws/example_bedrock.py:137:5: AIR301 `airflow.models.baseoperator.chain` is removed in Airflow 3.0
+ providers/amazon/tests/system/amazon/aws/example_bedrock.py:137:5: AIR311 `airflow.models.baseoperator.chain` 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/system/amazon/aws/example_bedrock.py:197:5: AIR301 `airflow.models.baseoperator.chain` is removed in Airflow 3.0
+ providers/amazon/tests/system/amazon/aws/example_bedrock.py:197:5: AIR311 `airflow.models.baseoperator.chain` 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/system/amazon/aws/example_bedrock_batch_inference.py:167:5: AIR301 `airflow.models.baseoperator.chain` is removed in Airflow 3.0
+ providers/amazon/tests/system/amazon/aws/example_bedrock_batch_inference.py:167:5: AIR311 `airflow.models.baseoperator.chain` 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/system/amazon/aws/example_bedrock_retrieve_and_generate.py:111:5: AIR301 `airflow.models.baseoperator.chain` is removed in Airflow 3.0
+ providers/amazon/tests/system/amazon/aws/example_bedrock_retrieve_and_generate.py:111:5: AIR311 `airflow.models.baseoperator.chain` 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/system/amazon/aws/example_bedrock_retrieve_and_generate.py:112:5: AIR301 `airflow.models.baseoperator.chain` is removed in Airflow 3.0
+ providers/amazon/tests/system/amazon/aws/example_bedrock_retrieve_and_generate.py:112:5: AIR311 `airflow.models.baseoperator.chain` 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/system/amazon/aws/example_bedrock_retrieve_and_generate.py:567:5: AIR301 `airflow.models.baseoperator.chain` is removed in Airflow 3.0
+ providers/amazon/tests/system/amazon/aws/example_bedrock_retrieve_and_generate.py:567:5: AIR311 `airflow.models.baseoperator.chain` 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/system/amazon/aws/example_cloudformation.py:101:5: AIR301 `airflow.models.baseoperator.chain` is removed in Airflow 3.0
+ providers/amazon/tests/system/amazon/aws/example_cloudformation.py:101:5: AIR311 `airflow.models.baseoperator.chain` 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/system/amazon/aws/example_comprehend.py:118:5: AIR301 `airflow.models.baseoperator.chain` is removed in Airflow 3.0
+ providers/amazon/tests/system/amazon/aws/example_comprehend.py:118:5: AIR311 `airflow.models.baseoperator.chain` 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/system/amazon/aws/example_comprehend.py:74:5: AIR301 `airflow.models.baseoperator.chain` is removed in Airflow 3.0
+ providers/amazon/tests/system/amazon/aws/example_comprehend.py:74:5: AIR311 `airflow.models.baseoperator.chain` 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/system/amazon/aws/example_comprehend_document_classifier.py:109:5: AIR301 `airflow.models.baseoperator.chain` is removed in Airflow 3.0
+ providers/amazon/tests/system/amazon/aws/example_comprehend_document_classifier.py:109:5: AIR311 `airflow.models.baseoperator.chain` 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/system/amazon/aws/example_comprehend_document_classifier.py:198:5: AIR301 `airflow.models.baseoperator.chain` is removed in Airflow 3.0
+ providers/amazon/tests/system/amazon/aws/example_comprehend_document_classifier.py:198:5: AIR311 `airflow.models.baseoperator.chain` 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/system/amazon/aws/example_datasync.py:217:5: AIR301 `airflow.models.baseoperator.chain` is removed in Airflow 3.0
+ providers/amazon/tests/system/amazon/aws/example_datasync.py:217:5: AIR311 `airflow.models.baseoperator.chain` 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/system/amazon/aws/example_dms.py:408:5: AIR301 `airflow.models.baseoperator.chain` is removed in Airflow 3.0
+ providers/amazon/tests/system/amazon/aws/example_dms.py:408:5: AIR311 `airflow.models.baseoperator.chain` 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/system/amazon/aws/example_dms_serverless.py:345:5: AIR301 `airflow.models.baseoperator.chain` is removed in Airflow 3.0
+ providers/amazon/tests/system/amazon/aws/example_dms_serverless.py:345:5: AIR311 `airflow.models.baseoperator.chain` 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/system/amazon/aws/example_dynamodb.py:109:5: AIR301 `airflow.models.baseoperator.chain` is removed in Airflow 3.0
+ providers/amazon/tests/system/amazon/aws/example_dynamodb.py:109:5: AIR311 `airflow.models.baseoperator.chain` 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/system/amazon/aws/example_dynamodb_to_s3.py:154:5: AIR301 `airflow.models.baseoperator.chain` is removed in Airflow 3.0
+ providers/amazon/tests/system/amazon/aws/example_dynamodb_to_s3.py:154:5: AIR311 `airflow.models.baseoperator.chain` 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/system/amazon/aws/example_dynamodb_to_s3.py:234:5: AIR301 `airflow.models.baseoperator.chain` is removed in Airflow 3.0
+ providers/amazon/tests/system/amazon/aws/example_dynamodb_to_s3.py:234:5: AIR311 `airflow.models.baseoperator.chain` 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/system/amazon/aws/example_ec2.py:187:5: AIR301 `airflow.models.baseoperator.chain` is removed in Airflow 3.0
+ providers/amazon/tests/system/amazon/aws/example_ec2.py:187:5: AIR311 `airflow.models.baseoperator.chain` 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/system/amazon/aws/example_ecs.py:199:5: AIR301 `airflow.models.baseoperator.chain` is removed in Airflow 3.0
+ providers/amazon/tests/system/amazon/aws/example_ecs.py:199:5: AIR311 `airflow.models.baseoperator.chain` is removed in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version.
... 218 additional changes omitted for project

Changes by rule (2 rules affected)

code total + violation - violation + fix - fix
AIR311 134 134 0 0 0
AIR301 134 0 134 0 0

@Lee-W
Copy link
Contributor Author

Lee-W commented Apr 10, 2025

Hey @ntBre , I might have some refactoring on this one but would appreciate it if we could get an early review to see if I'm doing things right. Thanks 🙂

@Lee-W
Copy link
Contributor Author

Lee-W commented Apr 12, 2025

@ntBre After a second check, I think this is ready to be reviewed. Thanks!

@Lee-W Lee-W force-pushed the extract-AIR301-to-AIR311 branch from eab4f77 to 2a681b3 Compare April 13, 2025 10:10
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! Just some minor nits, but this looks great overall.

@Lee-W
Copy link
Contributor Author

Lee-W commented Apr 15, 2025

btw do you know when will the next version be released?

@ntBre
Copy link
Contributor

ntBre commented Apr 15, 2025

btw do you know when will the next version be released?

Should be this Thursday!

@dhruvmanila dhruvmanila added rule Implementing or modifying a lint rule preview Related to preview mode features labels Apr 15, 2025
@ntBre
Copy link
Contributor

ntBre commented Apr 15, 2025

Is this ready for one more quick review and then merging? I see the comments are resolved, but I don't see any new commits. Maybe GitHub is showing things out of order, though.

@Lee-W
Copy link
Contributor Author

Lee-W commented Apr 15, 2025

@ntBre yep, this is ready. I guess I might have fixed up some commits (but there should still have one or two new commits 🤔

@Lee-W Lee-W force-pushed the extract-AIR301-to-AIR311 branch from 2a681b3 to 1a06c1d Compare April 15, 2025 23:33
@Lee-W
Copy link
Contributor Author

Lee-W commented Apr 15, 2025

in case of anything missed, i just rebase from the latest main and pushed again

@Lee-W Lee-W force-pushed the extract-AIR301-to-AIR311 branch from 1a06c1d to 785cb1b Compare April 16, 2025 07:30
@Lee-W Lee-W mentioned this pull request Apr 16, 2025
2 tasks
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! I have one more question about a rule code. Is there somewhere that both Airflow3SuggestedUpdate and Airflow3Removal are being emitted? I'm a bit confused how both rules are active at once since the test_case should only be activating Airflow3SuggestedUpdate.

Lee-W added 9 commits April 16, 2025 22:48
* arguments
    * `airflow..DAG
dag`
        * `sla_miss_callback`
    * operators
        * `sla`
* name
    * `airflow.Dataset]
[airflow.datasets.Dataset` → `airflow.sdk.Asset`
    * `airflow.datasets, rest @ ..`
        * `DatasetAlias` → `airflow.sdk.AssetAlias`
        * `DatasetAll` → `airflow.sdk.AssetAll`
        * `DatasetAny` → `airflow.sdk.AssetAny`
        * `expand_alias_to_datasets` → `airflow.sdk.expand_alias_to_assets`
        * `metadata.Metadata` → `airflow.sdk.Metadata`
    <!--airflow.models.baseoperator-->
    * `airflow.models.baseoperator.chain` → `airflow.sdk.chain`
    * `airflow.models.baseoperator.chain_linear` → `airflow.sdk.chain_linear`
    * `airflow.models.baseoperator.cross_downstream` → `airflow.sdk.cross_downstream`
    * `airflow.models.baseoperatorlink.BaseOperatorLink` → `airflow.sdk.definitions.baseoperatorlink.BaseOperatorLink`
    * `airflow.timetables, rest @ ..`
        * `datasets.DatasetOrTimeSchedule` → * `airflow.timetables.assets.AssetOrTimeSchedule`
    * `airflow.utils, rest @ ..`
        <!--airflow.utils.dag_parsing_context-->
        * `dag_parsing_context.get_parsing_context` → `airflow.sdk.get_parsing_context`
@Lee-W Lee-W force-pushed the extract-AIR301-to-AIR311 branch from 785cb1b to 2b8bce1 Compare April 16, 2025 14:48
@ntBre ntBre merged commit e6a2de3 into astral-sh:main Apr 16, 2025
22 checks passed
dcreager added a commit that referenced this pull request Apr 16, 2025
* main: (44 commits)
  [`airflow`] Extend `AIR311` rules (#17422)
  [red-knot] simplify union size limit handling (#17429)
  [`airflow`] Extract `AIR311` from `AIR301` rules (`AIR301`, `AIR311`) (#17310)
  [red-knot] set a size limit on unions of literals (#17419)
  [red-knot] make large-union benchmark slow again (#17418)
  [red-knot] optimize building large unions of literals (#17403)
  [red-knot] Fix comments in type_api.md (#17425)
  [red-knot] Do not assume that `x != 0` if `x` inhabits `~Literal[0]` (#17370)
  [red-knot] make large-union benchmark more challenging (#17416)
  [red-knot] Acknowledge that `T & anything` is assignable to `T` (#17413)
  Update Rust crate clap to v4.5.36 (#17381)
  Raise syntax error when `\` is at end of file (#17409)
  [red-knot] Add regression tests for narrowing constraints cycles (#17408)
  [red-knot] Add some knowledge of `__all__` to `*`-import machinery (#17373)
  Update taiki-e/install-action digest to be7c31b (#17379)
  Update Rust crate mimalloc to v0.1.46 (#17382)
  Update PyO3/maturin-action action to v1.49.1 (#17384)
  Update Rust crate anyhow to v1.0.98 (#17380)
  dependencies: switch from `chrono` to `jiff`
  Update Rust crate bstr to v1.12.0 (#17385)
  ...
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.

3 participants