potiuk commented on code in PR #59922:
URL: https://github.com/apache/airflow/pull/59922#discussion_r2662134118


##########
airflow-core/src/airflow/utils/context.py:
##########
@@ -32,51 +32,16 @@
     VariableAccessor as VariableAccessorSDK,
 )
 from airflow.serialization.definitions.notset import NOTSET, is_arg_set
-from airflow.utils.deprecation_tools import DeprecatedImportWarning
+from airflow.utils.deprecation_tools import DeprecatedImportWarning, 
add_deprecated_classes
 from airflow.utils.session import create_session
 
-# NOTE: Please keep this in sync with the following:
-# * Context in task-sdk/src/airflow/sdk/definitions/context.py
-# * Table in docs/apache-airflow/templates-ref.rst
-KNOWN_CONTEXT_KEYS: set[str] = {
-    "conn",
-    "dag",
-    "dag_run",
-    "data_interval_end",
-    "data_interval_start",
-    "ds",
-    "ds_nodash",
-    "expanded_ti_count",
-    "exception",
-    "inlets",
-    "inlet_events",
-    "logical_date",
-    "macros",
-    "map_index_template",
-    "outlets",
-    "outlet_events",
-    "params",
-    "prev_data_interval_start_success",
-    "prev_data_interval_end_success",
-    "prev_start_date_success",
-    "prev_end_date_success",
-    "reason",
-    "run_id",
-    "start_date",
-    "task",
-    "task_reschedule_count",
-    "task_instance",
-    "task_instance_key_str",
-    "test_mode",
-    "templates_dict",
-    "ti",
-    "triggering_asset_events",
-    "ts",
-    "ts_nodash",
-    "ts_nodash_with_tz",
-    "try_number",
-    "var",
-}
+warnings.warn(
+    "Module airflow.utils.context is deprecated and will be removed in the "
+    "future. Use airflow.sdk.execution_time.context if you are using the "
+    "classes inside an Airflow task.",
+    DeprecatedImportWarning,

Review Comment:
   Yeah. I am not a big fan of specifying versions in removal. I am ok with 
Dates (as long as they are followed - see Google Provider deprecation 
policies), but specifying a version number is not a good idea. We might at some 
point of time decide to remove it even before Airflow 4. We are not bound here 
to keep it due to SemVer, we are keeping it because we do not want to make it 
difficult for users to migrate, and we might at some point of time decide to 
remove some deprecations if we assess that it brings more cost than benefits. 



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to