[airflow] Second positional argument to Asset/Dataset should not be a dictionary (AIR303)#22453
Merged
ntBre merged 6 commits intoastral-sh:mainfrom Jan 17, 2026
Conversation
|
Lee-W
reviewed
Jan 8, 2026
crates/ruff_linter/src/rules/airflow/rules/function_signature_change_in_3.rs
Outdated
Show resolved
Hide resolved
dafc4b3 to
cf31b81
Compare
sjyangkevin
commented
Jan 8, 2026
crates/ruff_linter/src/rules/airflow/rules/function_signature_change_in_3.rs
Outdated
Show resolved
Hide resolved
Lee-W
reviewed
Jan 9, 2026
Contributor
Lee-W
left a comment
There was a problem hiding this comment.
LGTM after the last nit 👍 Thanks!
crates/ruff_linter/src/rules/airflow/rules/function_signature_change_in_3.rs
Outdated
Show resolved
Hide resolved
1 task
sjyangkevin
commented
Jan 9, 2026
crates/ruff_linter/src/rules/airflow/rules/function_signature_change_in_3.rs
Show resolved
Hide resolved
ntBre
reviewed
Jan 15, 2026
Contributor
ntBre
left a comment
There was a problem hiding this comment.
Thank you! This looks good to me overall, just a couple of minor suggestions about additional cases you could handle, if you want.
crates/ruff_linter/src/rules/airflow/rules/function_signature_change_in_3.rs
Show resolved
Hide resolved
crates/ruff_linter/src/rules/airflow/rules/function_signature_change_in_3.rs
Show resolved
Hide resolved
crates/ruff_linter/src/rules/airflow/rules/function_signature_change_in_3.rs
Show resolved
Hide resolved
28524a4 to
54274a1
Compare
Lee-W
reviewed
Jan 17, 2026
| Asset("asset1") | ||
| Asset("asset1", extra={"key": "value"}) | ||
| Asset(uri="asset1", extra={"key": "value"}) | ||
|
|
Contributor
There was a problem hiding this comment.
Suggested change
nit: additional blank line
Contributor
Author
There was a problem hiding this comment.
fixed. thanks for caching it.
Lee-W
reviewed
Jan 17, 2026
Contributor
Lee-W
left a comment
There was a problem hiding this comment.
Just took a look again. LGTM. Thanks all!
54274a1 to
60f8ec2
Compare
airflow] Second positional argument to Asset/Dataset should not be a dictionary (AIR303)airflow] Second positional argument to Asset/Dataset should not be a dictionary (AIR303)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR is related to apache/airflow#48389.
In Airflow 3, the function signature for
airflow.Dataset,airflow.datasets.Dataset, andairflow.sdk.Assethas changed. Below is the function signature forairflow.sdk.Asset. The second positional argument isuriwhich is of typestr. In the older version, the second positional argument can be a dictionary which is theextra: 'dict | None' = Noneargument. Therefore, we need to flag this in Airflow 3.As this is a check on constructor call, we need to create a new method
check_constructor_arguments, instead of on method call. The new rule check whether the index 1 (the second argument) is a dictionary (either a literal or adict()call).Test Plan
The
AIR303.pytest file have been updated with new test cases. The snapshot has been updated and all other test cases passed.@Lee-W , could you please review it when you have a chance, and let me know if you have further feedback. Thanks!