Skip to content

Add ruff rules to catch deprecated Airflow imports for Airflow 3.1 #54714

@amoghrajesh

Description

@amoghrajesh

Body

Description

We need to implement ruff rules to catch and/or auto-fix deprecated imports in Airflow for Airflow 3.1. These rules should help users migrate from old import paths to new ones.

Implementation Checklist

airflow.utils module

  • airflow.utils.setup_teardown.BaseSetupTeardownContextairflow.sdk.definitions._internal.setup_teardown.BaseSetupTeardownContext
  • airflow.utils.setup_teardown.SetupTeardownContextairflow.sdk.definitions._internal.setup_teardown.SetupTeardownContext
  • airflow.utils.xcom.XCOM_RETURN_KEYairflow.models.xcom.XCOM_RETURN_KEY
  • airflow.utils.task_group.TaskGroupairflow.sdk.TaskGroup
  • airflow.utils.task_group.get_task_group_children_getterairflow.sdk.definitions.taskgroup.get_task_group_children_getter
  • airflow.utils.task_group.task_group_to_dictairflow.sdk.definitions.taskgroup.task_group_to_dict
  • airflow.utils.timezone.*airflow.sdk.timezone
  • airflow.utils.decorators.remove_task_decoratorairflow.sdk.definitions._internal.decorators.remove_task_decorator
  • airflow.utils.decorators.fixup_decorator_warning_stackairflow.sdk.definitions._internal.decorators.fixup_decorator_warning_stack

airflow.sensors module

  • airflow.sensors.base.BaseSensorOperatorairflow.sdk.bases.sensor.BaseSensorOperator
  • airflow.sensors.base.PokeReturnValueairflow.sdk.bases.sensor.PokeReturnValue
  • airflow.sensors.base.poke_mode_onlyairflow.sdk.bases.sensor.poke_mode_only
  • airflow.sensors.python.PythonSensorairflow.providers.standard.sensors.python.PythonSensor
  • airflow.sensors.bash.BashSensorairflow.providers.standard.sensors.bash.BashSensor
  • airflow.sensors.date_time.DateTimeSensorairflow.providers.standard.sensors.date_time.DateTimeSensor
  • airflow.sensors.date_time.DateTimeSensorAsyncairflow.providers.standard.sensors.date_time.DateTimeSensorAsync

airflow.secrets module

  • airflow.secrets.cache.SecretCacheairflow.sdk.execution_time.cache.SecretCache

airflow.notifications module

  • airflow.notifications.basenotifier.BaseNotifierairflow.sdk.bases.notifier.BaseNotifier

airflow.models module

  • airflow.models.abstractoperator.AbstractOperatorairflow.sdk.definitions._internal.abstractoperator.AbstractOperator
  • airflow.models.abstractoperator.NotMappedairflow.sdk.definitions._internal.abstractoperator.NotMapped
  • airflow.models.abstractoperator.TaskStateChangeCallbackairflow.sdk.definitions._internal.abstractoperator.TaskStateChangeCallback
  • airflow.models.param.Paramairflow.sdk.definitions.param.Param
  • airflow.models.param.ParamsDictairflow.sdk.definitions.param.ParamsDict
  • airflow.models.baseoperator.BaseOperatorairflow.sdk.bases.operator.BaseOperator
  • airflow.models.baseoperator.chainairflow.sdk.bases.operator.chain

airflow.macros module

  • airflow.macros.*airflow.sdk.execution_time.macros

airflow.io module

  • airflow.io.get_fsairflow.sdk.io.get_fs
  • airflow.io.has_fsairflow.sdk.io.has_fs
  • airflow.io.attachairflow.sdk.io.attach
  • airflow.io.Propertiesairflow.sdk.io.Properties
  • airflow.io.path.ObjectStoragePathairflow.sdk.ObjectStoragePath

airflow.hooks module

  • airflow.hooks.filesystem.FSHookairflow.providers.standard.hooks.filesystem.FSHook
  • airflow.hooks.base.BaseHookairflow.sdk.bases.hook.BaseHook

airflow.decorators module

  • airflow.decorators.dagairflow.sdk.dag
  • airflow.decorators.taskairflow.sdk.task
  • airflow.decorators.task_groupairflow.sdk.task_group
  • airflow.decorators.base.DecoratedOperatorairflow.sdk.bases.decorator.DecoratedOperator

Notes

  • Some imports may have already been done
  • We can use this as a knowledge base to develop assertion dags that import and validate old vs new paths for better user onboarding
  • Consider phasing the implementation if the scope is too large

Committer

  • I acknowledge that I am a maintainer/committer of the Apache Airflow project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:corekind:featureFeature Requestskind:metaHigh-level information important to the community

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions