From 795e1db64177e35ff72912a7f60d54867eb1d1d9 Mon Sep 17 00:00:00 2001 From: PoAn Yang Date: Wed, 24 Jun 2026 15:41:24 +0900 Subject: [PATCH] [AIP-94] Mark variables CLI commands as migrated to airflowctl Under AIP-94 the remote variables CLI commands are frozen so new development goes to airflowctl. Following the marker-only direction from #68726, record their airflowctl counterparts for maintainers without emitting any user-facing deprecation warning. Signed-off-by: PoAn Yang --- airflow-core/src/airflow/cli/commands/variable_command.py | 7 ++++++- .../tests/unit/cli/commands/test_command_deprecations.py | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/airflow-core/src/airflow/cli/commands/variable_command.py b/airflow-core/src/airflow/cli/commands/variable_command.py index 5216aabb446c6..194b02b529a97 100644 --- a/airflow-core/src/airflow/cli/commands/variable_command.py +++ b/airflow-core/src/airflow/cli/commands/variable_command.py @@ -26,7 +26,7 @@ from sqlalchemy import select from airflow.cli.simple_table import AirflowConsole -from airflow.cli.utils import SENSITIVE_PLACEHOLDER, print_export_output +from airflow.cli.utils import SENSITIVE_PLACEHOLDER, deprecated_for_airflowctl, print_export_output from airflow.exceptions import ( AirflowFileParseException, AirflowUnsupportedFileTypeException, @@ -63,6 +63,7 @@ def with_values(var, hide_sensitive: bool = False) -> dict[str, str]: return {"key": key, "val": val} +@deprecated_for_airflowctl("airflowctl variables list") @suppress_logs_and_warning @providers_configuration_loaded def variables_list(args): @@ -92,6 +93,7 @@ def _mapper(var): AirflowConsole().print_as(data=variables, output=args.output, mapper=None) +@deprecated_for_airflowctl("airflowctl variables get") @suppress_logs_and_warning @providers_configuration_loaded def variables_get(args): @@ -108,6 +110,7 @@ def variables_get(args): @cli_utils.action_cli +@deprecated_for_airflowctl("airflowctl variables create") @providers_configuration_loaded def variables_set(args): """Create new variable with a given name, value and description.""" @@ -116,6 +119,7 @@ def variables_set(args): @cli_utils.action_cli +@deprecated_for_airflowctl("airflowctl variables delete") @providers_configuration_loaded def variables_delete(args): """Delete variable by a given name.""" @@ -124,6 +128,7 @@ def variables_delete(args): @cli_utils.action_cli +@deprecated_for_airflowctl("airflowctl variables import") @providers_configuration_loaded @provide_session def variables_import(args, *, session: Session = NEW_SESSION): diff --git a/airflow-core/tests/unit/cli/commands/test_command_deprecations.py b/airflow-core/tests/unit/cli/commands/test_command_deprecations.py index 9300219fe5a1e..b7b1314513168 100644 --- a/airflow-core/tests/unit/cli/commands/test_command_deprecations.py +++ b/airflow-core/tests/unit/cli/commands/test_command_deprecations.py @@ -30,7 +30,7 @@ import pytest -from airflow.cli.commands import asset_command, dag_command, pool_command +from airflow.cli.commands import asset_command, dag_command, pool_command, variable_command # (command callable, expected airflowctl replacement recorded by the decorator) MIGRATED_CLI_COMMANDS = [ @@ -42,6 +42,11 @@ (pool_command.pool_delete, "airflowctl pools delete"), (pool_command.pool_import, "airflowctl pools import"), (pool_command.pool_export, "airflowctl pools export"), + (variable_command.variables_list, "airflowctl variables list"), + (variable_command.variables_get, "airflowctl variables get"), + (variable_command.variables_set, "airflowctl variables create"), + (variable_command.variables_delete, "airflowctl variables delete"), + (variable_command.variables_import, "airflowctl variables import"), (asset_command.asset_materialize, "airflowctl assets materialize"), ]