You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "uranusjr (via GitHub)" <gi...@apache.org> on 2026/03/26 06:32:33 UTC

[PR] Deprecate Asset.extra [airflow]

uranusjr opened a new pull request, #64243:
URL: https://github.com/apache/airflow/pull/64243

   I actually also had event_extra_template implemented locally, but when I was about to write the documentation, I realised its use case is… very limited? It can only be static, and really the worst case scenario without it is you repeat them when you emit events.
   
   Since we generally discourage emitting events of the same asset in different dags anyway, all this really helps would be to save you a few keystrokes. I couldn’t justify to myself to implement it.
   
   Therefore, this PR only contains deprecation to a confusing and not-really-useful feature. It does not provide a replacement.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Deprecate Asset.extra [airflow]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #64243:
URL: https://github.com/apache/airflow/pull/64243#issuecomment-4910291917

   This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Deprecate Asset.extra [airflow]

Posted by "uranusjr (via GitHub)" <gi...@apache.org>.
uranusjr commented on code in PR #64243:
URL: https://github.com/apache/airflow/pull/64243#discussion_r2999732915


##########
task-sdk/src/airflow/sdk/definitions/asset/__init__.py:
##########
@@ -404,6 +407,20 @@ def normalized_uri(self) -> str | None:
         except ValueError:
             return None
 
+    @property
+    def extra(self) -> dict[str, JsonValue]:
+        # No warning here; a warning is shown when the value is set.
+        return self._extra
+
+    @extra.setter
+    def extra(self, value: dict[str, JsonValue]) -> None:
+        warnings.warn(
+            "Asset.extra is deprecated and will be removed in the future.",
+            RemovedInAirflow4Warning,
+            stacklevel=2,
+        )
+        self._extra = value

Review Comment:
   Honestly I am not even sure when `DeprecatedImportWarning` should be used (I guess on imports…? And it also still implies removal on Airflow 4…?) But this is not supposed to be triggered on an import anyway so `RemovedInAirflow4Warning` is definitely the right one to use.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Deprecate Asset.extra [airflow]

Posted by "uranusjr (via GitHub)" <gi...@apache.org>.
uranusjr commented on code in PR #64243:
URL: https://github.com/apache/airflow/pull/64243#discussion_r2999735384


##########
airflow-core/src/airflow/serialization/decoders.py:
##########
@@ -106,6 +105,8 @@ def _decode_asset(var: dict[str, Any]):
             )
             for watcher in watchers
         ],
+        # TODO: Deprecated in SDK. Remove in Airflow 4.0.

Review Comment:
   I was thinking this might be confusing if we decouple SDK and Core versioning.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Deprecate Asset.extra [airflow]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #64243: Deprecate Asset.extra
URL: https://github.com/apache/airflow/pull/64243


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Deprecate Asset.extra [airflow]

Posted by "amoghrajesh (via GitHub)" <gi...@apache.org>.
amoghrajesh commented on code in PR #64243:
URL: https://github.com/apache/airflow/pull/64243#discussion_r2992860458


##########
airflow-core/src/airflow/serialization/decoders.py:
##########
@@ -106,6 +105,8 @@ def _decode_asset(var: dict[str, Any]):
             )
             for watcher in watchers
         ],
+        # TODO: Deprecated in SDK. Remove in Airflow 4.0.

Review Comment:
   ```suggestion
           # TODO: Deprecated in SDK in 3.2. Remove in Airflow 4.0.
   ```



##########
airflow-core/src/airflow/serialization/definitions/assets.py:
##########
@@ -118,9 +119,11 @@ class SerializedAsset(SerializedAssetBase):
     name: str
     uri: str
     group: str
-    extra: dict[str, Any]
     watchers: MutableSequence[SerializedAssetWatcher]
 
+    # TODO: Deprecated in SDK. Remove in Airflow 4.0.
+    extra: dict[str, JsonValue]

Review Comment:
   ```suggestion
       # TODO: Deprecated in SDK in 3.2. Remove in Airflow 4.0.
       extra: dict[str, JsonValue]
   ```



##########
task-sdk/src/airflow/sdk/definitions/asset/__init__.py:
##########
@@ -404,6 +407,20 @@ def normalized_uri(self) -> str | None:
         except ValueError:
             return None
 
+    @property
+    def extra(self) -> dict[str, JsonValue]:
+        # No warning here; a warning is shown when the value is set.
+        return self._extra
+
+    @extra.setter
+    def extra(self, value: dict[str, JsonValue]) -> None:
+        warnings.warn(
+            "Asset.extra is deprecated and will be removed in the future.",
+            RemovedInAirflow4Warning,
+            stacklevel=2,
+        )
+        self._extra = value

Review Comment:
   No complaint but we use `RemovedInAirflow4Warning` and `DeprecatedImportWarning` randomly, so just flagging that here if that one's more relevant, but in this case since we know we want to nuke in AF4, I think we are OK?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org