diff --git a/astronomer/providers/amazon/aws/operators/batch.py b/astronomer/providers/amazon/aws/operators/batch.py index 1eda818ea..d7aff1ea0 100644 --- a/astronomer/providers/amazon/aws/operators/batch.py +++ b/astronomer/providers/amazon/aws/operators/batch.py @@ -23,6 +23,9 @@ class BatchOperatorAsync(BatchOperator): and set `deferrable` param to `True` instead. """ + is_deprecated = True + post_deprecation_replacement = "from airflow.providers.amazon.aws.operators.batch import BatchOperator" + def __init__(self, *args: Any, **kwargs: Any) -> None: warnings.warn( ( diff --git a/astronomer/providers/amazon/aws/operators/emr.py b/astronomer/providers/amazon/aws/operators/emr.py index c21bfe261..ea582a0cd 100644 --- a/astronomer/providers/amazon/aws/operators/emr.py +++ b/astronomer/providers/amazon/aws/operators/emr.py @@ -9,6 +9,11 @@ class EmrContainerOperatorAsync(EmrContainerOperator): Please use :class: `~airflow.providers.amazon.aws.operators.emr.EmrContainerOperator`. """ + is_deprecated = True + post_deprecation_replacement = ( + "from airflow.providers.amazon.aws.operators.emr import EmrContainerOperator" + ) + def __init__(self, *args, **kwargs): # type: ignore[no-untyped-def] warnings.warn( ( diff --git a/astronomer/providers/amazon/aws/operators/redshift_cluster.py b/astronomer/providers/amazon/aws/operators/redshift_cluster.py index 4e107d83e..aba1dd139 100644 --- a/astronomer/providers/amazon/aws/operators/redshift_cluster.py +++ b/astronomer/providers/amazon/aws/operators/redshift_cluster.py @@ -13,6 +13,11 @@ class RedshiftDeleteClusterOperatorAsync(RedshiftDeleteClusterOperator): Please use :class: `~airflow.providers.amazon.aws.operators.redshift_cluster.RedshiftDeleteClusterOperator`. """ + is_deprecated = True + post_deprecation_replacement = ( + "from airflow.providers.amazon.aws.operators.redshift_cluster import RedshiftDeleteClusterOperator" + ) + def __init__(self, *args, **kwargs): # type: ignore[no-untyped-def] warnings.warn( ( @@ -32,6 +37,11 @@ class RedshiftResumeClusterOperatorAsync(RedshiftResumeClusterOperator): Please use :class: `~airflow.providers.amazon.aws.operators.redshift_cluster.RedshiftResumeClusterOperator`. """ + is_deprecated = True + post_deprecation_replacement = ( + "from airflow.providers.amazon.aws.operators.redshift_cluster import RedshiftResumeClusterOperator" + ) + def __init__(self, *args, **kwargs): # type: ignore[no-untyped-def] warnings.warn( ( @@ -51,6 +61,11 @@ class RedshiftPauseClusterOperatorAsync(RedshiftPauseClusterOperator): Please use :class: `~airflow.providers.amazon.aws.operators.redshift_cluster.RedshiftPauseClusterOperator`. """ + is_deprecated = True + post_deprecation_replacement = ( + "from airflow.providers.amazon.aws.operators.redshift_cluster import RedshiftPauseClusterOperator" + ) + def __init__(self, *args, **kwargs): # type: ignore[no-untyped-def] warnings.warn( ( diff --git a/astronomer/providers/amazon/aws/operators/redshift_data.py b/astronomer/providers/amazon/aws/operators/redshift_data.py index 9b6ebcb5d..5599806c7 100644 --- a/astronomer/providers/amazon/aws/operators/redshift_data.py +++ b/astronomer/providers/amazon/aws/operators/redshift_data.py @@ -11,6 +11,11 @@ class RedshiftDataOperatorAsync(RedshiftDataOperator): and set `deferrable` param to `True` instead. """ + is_deprecated = True + post_deprecation_replacement = ( + "from airflow.providers.amazon.aws.operators.redshift_data import RedshiftDataOperator" + ) + def __init__( self, **kwargs: Any, diff --git a/astronomer/providers/amazon/aws/operators/sagemaker.py b/astronomer/providers/amazon/aws/operators/sagemaker.py index d388a3244..830e9c760 100644 --- a/astronomer/providers/amazon/aws/operators/sagemaker.py +++ b/astronomer/providers/amazon/aws/operators/sagemaker.py @@ -24,6 +24,11 @@ class SageMakerProcessingOperatorAsync(SageMakerProcessingOperator): and set `deferrable` param to `True` instead. """ + is_deprecated = True + post_deprecation_replacement = ( + "from airflow.providers.amazon.aws.operators.sagemaker import SageMakerProcessingOperator" + ) + def __init__(self, **kwargs: Any) -> None: warnings.warn( ( @@ -44,6 +49,11 @@ class SageMakerTransformOperatorAsync(SageMakerTransformOperator): and set `deferrable` param to `True` instead. """ + is_deprecated = True + post_deprecation_replacement = ( + "from airflow.providers.amazon.aws.operators.sagemaker import SageMakerTransformOperator" + ) + def __init__(self, **kwargs: Any) -> None: warnings.warn( ( @@ -64,6 +74,11 @@ class SageMakerTrainingOperatorAsync(SageMakerTrainingOperator): and set `deferrable` param to `True` instead. """ + is_deprecated = True + post_deprecation_replacement = ( + "from airflow.providers.amazon.aws.operators.sagemaker import SageMakerTrainingOperator" + ) + def __init__(self, **kwargs: Any) -> None: warnings.warn( ( diff --git a/astronomer/providers/amazon/aws/sensors/batch.py b/astronomer/providers/amazon/aws/sensors/batch.py index 7c49018ae..de2bf6931 100644 --- a/astronomer/providers/amazon/aws/sensors/batch.py +++ b/astronomer/providers/amazon/aws/sensors/batch.py @@ -9,6 +9,9 @@ class BatchSensorAsync(BatchSensor): Please use :class: `~airflow.providers.amazon.aws.sensors.batch.BatchSensor`. """ + is_deprecated = True + post_deprecation_replacement = "from airflow.providers.amazon.aws.sensors.batch import BatchSensor" + def __init__(self, *args, **kwargs) -> None: # type: ignore[no-untyped-def] warnings.warn( ( diff --git a/astronomer/providers/amazon/aws/sensors/emr.py b/astronomer/providers/amazon/aws/sensors/emr.py index e5e9bbde9..fca4d6aea 100644 --- a/astronomer/providers/amazon/aws/sensors/emr.py +++ b/astronomer/providers/amazon/aws/sensors/emr.py @@ -15,6 +15,9 @@ class EmrContainerSensorAsync(EmrContainerSensor): Please use :class: `~airflow.providers.amazon.aws.sensors.emr.EmrContainerSensor`. """ + is_deprecated = True + post_deprecation_replacement = "from airflow.providers.amazon.aws.sensors.emr import EmrContainerSensor" + def __init__(self, *args, **kwargs) -> None: # type: ignore[no-untyped-def] poll_interval = kwargs.pop("poll_interval") if poll_interval: @@ -44,6 +47,9 @@ class EmrStepSensorAsync(EmrStepSensor): Please use :class: `~airflow.providers.amazon.aws.sensors.emr.EmrStepSensor`. """ + is_deprecated = True + post_deprecation_replacement = "from airflow.providers.amazon.aws.sensors.emr import EmrStepSensor" + def __init__(self, *args, **kwargs) -> None: # type: ignore[no-untyped-def] warnings.warn( ( @@ -63,6 +69,9 @@ class EmrJobFlowSensorAsync(EmrJobFlowSensor): Please use :class: `~airflow.providers.amazon.aws.sensors.emr.EmrJobFlowSensor`. """ + is_deprecated = True + post_deprecation_replacement = "from airflow.providers.amazon.aws.sensors.emr import EmrJobFlowSensor" + def __init__(self, *args, **kwargs) -> None: # type: ignore[no-untyped-def] warnings.warn( ( diff --git a/astronomer/providers/amazon/aws/sensors/redshift_cluster.py b/astronomer/providers/amazon/aws/sensors/redshift_cluster.py index 6f919bf22..3a568da2d 100644 --- a/astronomer/providers/amazon/aws/sensors/redshift_cluster.py +++ b/astronomer/providers/amazon/aws/sensors/redshift_cluster.py @@ -11,6 +11,11 @@ class RedshiftClusterSensorAsync(RedshiftClusterSensor): and set `deferrable` param to `True` instead. """ + is_deprecated = True + post_deprecation_replacement = ( + "from airflow.providers.amazon.aws.sensors.redshift_cluster import RedshiftClusterSensor" + ) + def __init__( self, **kwargs: Any, diff --git a/astronomer/providers/amazon/aws/sensors/s3.py b/astronomer/providers/amazon/aws/sensors/s3.py index ab0858c7e..f2c4924cc 100644 --- a/astronomer/providers/amazon/aws/sensors/s3.py +++ b/astronomer/providers/amazon/aws/sensors/s3.py @@ -14,6 +14,9 @@ class S3KeySensorAsync(S3KeySensor): and set `deferrable` param to `True` instead. """ + is_deprecated = True + post_deprecation_replacement = "from airflow.providers.amazon.aws.sensors.s3 import S3KeySensor" + def __init__(self, **kwargs: Any) -> None: warnings.warn( ( @@ -30,9 +33,12 @@ def __init__(self, **kwargs: Any) -> None: class S3KeySizeSensorAsync(S3KeySensorAsync): """ This class is deprecated. - Please use :class: `~astronomer.providers.amazon.aws.sensor.s3.S3KeySensorAsync`. + Please use :class: `~airflow.providers.amazon.aws.sensors.s3.S3KeySensor`. """ + is_deprecated = True + post_deprecation_replacement = "from airflow.providers.amazon.aws.sensors.s3 import S3KeySensor" + def __init__( self, *, @@ -42,7 +48,7 @@ def __init__( warnings.warn( """ S3KeySizeSensorAsync is deprecated. - Please use `astronomer.providers.amazon.aws.sensor.s3.S3KeySensorAsync`. + Please use `airflow.providers.amazon.aws.sensors.s3.S3KeySensor`. """, DeprecationWarning, stacklevel=2, @@ -57,6 +63,9 @@ class S3KeysUnchangedSensorAsync(S3KeysUnchangedSensor): Please use :class: `~airflow.providers.amazon.aws.sensors.s3.S3KeysUnchangedSensor`. """ + is_deprecated = True + post_deprecation_replacement = "from airflow.providers.amazon.aws.sensors.s3 import S3KeysUnchangedSensor" + def __init__(self, *args, **kwargs): # type: ignore[no-untyped-def] warnings.warn( ( @@ -73,9 +82,12 @@ def __init__(self, *args, **kwargs): # type: ignore[no-untyped-def] class S3PrefixSensorAsync(BaseSensorOperator): """ This class is deprecated. - Please use :class: `~astronomer.providers.amazon.aws.sensor.s3.S3KeySensorAsync`. + Please use :class: `~airflow.providers.amazon.aws.sensors.s3.S3KeySensor`. """ + is_deprecated = True + post_deprecation_replacement = "from airflow.providers.amazon.aws.sensors.s3 import S3KeySensor" + def __init__( self, *, @@ -89,7 +101,7 @@ def __init__( warnings.warn( """ S3PrefixSensor is deprecated. - Please use `astronomer.providers.amazon.aws.sensor.s3.S3KeySensorAsync`. + Please use `airflow.providers.amazon.aws.sensors.s3.S3KeySensor`. """, DeprecationWarning, stacklevel=2, diff --git a/astronomer/providers/apache/livy/operators/livy.py b/astronomer/providers/apache/livy/operators/livy.py index a2b8a0dad..cd83eb60e 100644 --- a/astronomer/providers/apache/livy/operators/livy.py +++ b/astronomer/providers/apache/livy/operators/livy.py @@ -15,6 +15,9 @@ class LivyOperatorAsync(LivyOperator): and set `deferrable` param to `True` instead. """ + is_deprecated = True + post_deprecation_replacement = "from airflow.providers.apache.livy.operators.livy import LivyOperator" + def __init__(self, *args: Any, **kwargs: Any) -> None: warnings.warn( "This class is deprecated. " diff --git a/astronomer/providers/cncf/kubernetes/operators/kubernetes_pod.py b/astronomer/providers/cncf/kubernetes/operators/kubernetes_pod.py index 603e99f05..76d682d82 100644 --- a/astronomer/providers/cncf/kubernetes/operators/kubernetes_pod.py +++ b/astronomer/providers/cncf/kubernetes/operators/kubernetes_pod.py @@ -21,6 +21,11 @@ class KubernetesPodOperatorAsync(KubernetesPodOperator): and set `deferrable` param to `True` instead. """ + is_deprecated = True + post_deprecation_replacement = ( + "from airflow.providers.cncf.kubernetes.operators.pod import KubernetesPodOperator" + ) + def __init__(self, **kwargs: Any): warnings.warn( ( diff --git a/astronomer/providers/core/sensors/external_task.py b/astronomer/providers/core/sensors/external_task.py index b1b277e8b..df9dad411 100644 --- a/astronomer/providers/core/sensors/external_task.py +++ b/astronomer/providers/core/sensors/external_task.py @@ -21,6 +21,9 @@ class ExternalTaskSensorAsync(ExternalTaskSensor): # noqa: D101 + is_deprecated = True + post_deprecation_replacement = "from airflow.sensors.external_task import ExternalTaskSensor" + def __init__( self, poke_interval: float = 5.0, diff --git a/astronomer/providers/core/sensors/filesystem.py b/astronomer/providers/core/sensors/filesystem.py index 53258d5a5..74b2c47f0 100644 --- a/astronomer/providers/core/sensors/filesystem.py +++ b/astronomer/providers/core/sensors/filesystem.py @@ -26,6 +26,9 @@ class FileSensorAsync(FileSensor): ``**`` in glob filepath parameter. Defaults to ``False``. """ + is_deprecated = True + post_deprecation_replacement = "from airflow.sensors.filesystem import FileSensor" + def __init__(self, *args: Any, **kwargs: Any) -> None: warnings.warn( ( diff --git a/astronomer/providers/databricks/hooks/databricks.py b/astronomer/providers/databricks/hooks/databricks.py index 53722ef0a..f6c387a66 100644 --- a/astronomer/providers/databricks/hooks/databricks.py +++ b/astronomer/providers/databricks/hooks/databricks.py @@ -128,7 +128,7 @@ async def _do_api_call_async( json=json if method in ("POST", "PATCH") else None, params=json if method == "GET" else None, headers=headers, - timeout=self.timeout_seconds, + timeout=self.timeout_seconds, # type: ignore[arg-type] ) response.raise_for_status() return cast(Dict[str, Any], await response.json()) diff --git a/astronomer/providers/databricks/operators/databricks.py b/astronomer/providers/databricks/operators/databricks.py index e5bb334fa..9cb913287 100644 --- a/astronomer/providers/databricks/operators/databricks.py +++ b/astronomer/providers/databricks/operators/databricks.py @@ -16,6 +16,11 @@ class DatabricksSubmitRunOperatorAsync(DatabricksSubmitRunOperator): `deferrable` param to `True` instead. """ + is_deprecated = True + post_deprecation_replacement = ( + "from airflow.providers.databricks.operators.databricks import DatabricksSubmitRunOperator" + ) + def __init__(self, *args: Any, **kwargs: Any) -> None: warnings.warn( "This class is deprecated." @@ -32,6 +37,11 @@ class DatabricksRunNowOperatorAsync(DatabricksRunNowOperator): `deferrable` param to `True` instead. """ + is_deprecated = True + post_deprecation_replacement = ( + "from airflow.providers.databricks.operators.databricks import DatabricksRunNowOperator" + ) + def __init__(self, *args: Any, **kwargs: Any) -> None: warnings.warn( "This class is deprecated." diff --git a/astronomer/providers/dbt/cloud/operators/dbt.py b/astronomer/providers/dbt/cloud/operators/dbt.py index 6a8f48c4b..0f3fd5c60 100644 --- a/astronomer/providers/dbt/cloud/operators/dbt.py +++ b/astronomer/providers/dbt/cloud/operators/dbt.py @@ -17,6 +17,11 @@ class DbtCloudRunJobOperatorAsync(DbtCloudRunJobOperator): and set `deferrable` param to `True` instead. """ + is_deprecated = True + post_deprecation_replacement = ( + "from airflow.providers.dbt.cloud.operators.dbt import DbtCloudRunJobOperator" + ) + def __init__(self, *args: Any, **kwargs: Any) -> None: warnings.warn( ( diff --git a/astronomer/providers/dbt/cloud/sensors/dbt.py b/astronomer/providers/dbt/cloud/sensors/dbt.py index e6b1683e8..9ea6420ae 100644 --- a/astronomer/providers/dbt/cloud/sensors/dbt.py +++ b/astronomer/providers/dbt/cloud/sensors/dbt.py @@ -13,6 +13,9 @@ class DbtCloudJobRunSensorAsync(DbtCloudJobRunSensor): and set `deferrable` param to `True` instead. """ + is_deprecated = True + post_deprecation_replacement = "from airflow.providers.dbt.cloud.sensors import DbtCloudJobRunSensor" + def __init__(self, *args: Any, **kwargs: Any) -> None: warnings.warn( ( diff --git a/astronomer/providers/google/cloud/operators/bigquery.py b/astronomer/providers/google/cloud/operators/bigquery.py index 3d07efc2e..540f62326 100644 --- a/astronomer/providers/google/cloud/operators/bigquery.py +++ b/astronomer/providers/google/cloud/operators/bigquery.py @@ -23,6 +23,9 @@ class BigQueryInsertJobOperatorAsync(BigQueryInsertJobOperator): and set `deferrable` param to `True` instead. """ + is_deprecated = True + post_deprecation_replacement = "from google.cloud.operators.bigquery import BigQueryInsertJobOperator" + def __init__(self, *args: Any, **kwargs: Any) -> None: warnings.warn( ( @@ -45,6 +48,9 @@ class BigQueryCheckOperatorAsync(BigQueryCheckOperator): and set `deferrable` param to `True` instead. """ + is_deprecated = True + post_deprecation_replacement = "from google.cloud.operators.bigquery import BigQueryCheckOperator" + def __init__(self, *args: Any, **kwargs: Any) -> None: warnings.warn( ( @@ -65,6 +71,9 @@ class BigQueryGetDataOperatorAsync(BigQueryGetDataOperator): and set `deferrable` param to `True` instead. """ + is_deprecated = True + post_deprecation_replacement = "from google.cloud.operators.bigquery import BigQueryGetDataOperator" + def __init__(self, *args: Any, use_legacy_sql: bool = False, **kwargs: Any) -> None: warnings.warn( ( @@ -86,6 +95,9 @@ class BigQueryIntervalCheckOperatorAsync(BigQueryIntervalCheckOperator): and set `deferrable` param to `True` instead. """ + is_deprecated = True + post_deprecation_replacement = "from google.cloud.operators.bigquery import BigQueryIntervalCheckOperator" + def __init__(self, *args: Any, **kwargs: Any) -> None: warnings.warn( ( @@ -106,6 +118,9 @@ class BigQueryValueCheckOperatorAsync(BigQueryValueCheckOperator): and set `deferrable` param to `True` instead. """ + is_deprecated = True + post_deprecation_replacement = "from google.cloud.operators.bigquery import BigQueryValueCheckOperator" + def __init__(self, *args: Any, **kwargs: Any) -> None: warnings.warn( ( diff --git a/astronomer/providers/google/cloud/operators/dataproc.py b/astronomer/providers/google/cloud/operators/dataproc.py index dff462020..d698af355 100644 --- a/astronomer/providers/google/cloud/operators/dataproc.py +++ b/astronomer/providers/google/cloud/operators/dataproc.py @@ -20,6 +20,11 @@ class DataprocCreateClusterOperatorAsync(DataprocCreateClusterOperator): and set `deferrable` param to `True` instead. """ + is_deprecated = True + post_deprecation_replacement = ( + "from airflow.providers.google.cloud.operators.dataproc import DataprocCreateClusterOperator" + ) + def __init__( self, *, @@ -46,6 +51,11 @@ class DataprocDeleteClusterOperatorAsync(DataprocDeleteClusterOperator): and set `deferrable` param to `True` instead. """ + is_deprecated = True + post_deprecation_replacement = ( + "from airflow.providers.google.cloud.operators.dataproc import DataprocDeleteClusterOperator" + ) + def __init__( self, *, @@ -74,6 +84,11 @@ class DataprocSubmitJobOperatorAsync(DataprocSubmitJobOperator): and set `deferrable` param to `True` instead. """ + is_deprecated = True + post_deprecation_replacement = ( + "from airflow.providers.google.cloud.operators.dataproc import DataprocSubmitJobOperator" + ) + def __init__(self, *args: Any, **kwargs: Any): warnings.warn( ( @@ -94,6 +109,11 @@ class DataprocUpdateClusterOperatorAsync(DataprocUpdateClusterOperator): and set `deferrable` param to `True` instead. """ + is_deprecated = True + post_deprecation_replacement = ( + "from airflow.providers.google.cloud.operators.dataproc import DataprocUpdateClusterOperator" + ) + def __init__( self, *, diff --git a/astronomer/providers/google/cloud/operators/kubernetes_engine.py b/astronomer/providers/google/cloud/operators/kubernetes_engine.py index 5a70b4bcd..103ad6e26 100644 --- a/astronomer/providers/google/cloud/operators/kubernetes_engine.py +++ b/astronomer/providers/google/cloud/operators/kubernetes_engine.py @@ -15,6 +15,11 @@ class GKEStartPodOperatorAsync(GKEStartPodOperator): and set `deferrable` param to `True` instead. """ + is_deprecated = True + post_deprecation_replacement = ( + "from airflow.providers.google.cloud.operators.kubernetes_engine import GKEStartPodOperator" + ) + def __init__(self, *args: Any, **kwargs: Any) -> None: warnings.warn( ( diff --git a/astronomer/providers/google/cloud/sensors/bigquery.py b/astronomer/providers/google/cloud/sensors/bigquery.py index 030857b15..fbb47c89b 100644 --- a/astronomer/providers/google/cloud/sensors/bigquery.py +++ b/astronomer/providers/google/cloud/sensors/bigquery.py @@ -15,6 +15,11 @@ class BigQueryTableExistenceSensorAsync(BigQueryTableExistenceSensor): and set `deferrable` param to `True` instead. """ + is_deprecated = True + post_deprecation_replacement = ( + "from airflow.providers.google.cloud.sensors.bigquery import BigQueryTableExistenceSensor" + ) + def __init__( self, gcp_conn_id: str = "google_cloud_default", diff --git a/astronomer/providers/google/cloud/sensors/gcs.py b/astronomer/providers/google/cloud/sensors/gcs.py index 0465e2de7..03512c7ca 100644 --- a/astronomer/providers/google/cloud/sensors/gcs.py +++ b/astronomer/providers/google/cloud/sensors/gcs.py @@ -20,6 +20,11 @@ class GCSObjectExistenceSensorAsync(GCSObjectExistenceSensor): and set `deferrable` param to `True` instead. """ + is_deprecated = True + post_deprecation_replacement = ( + "from airflow.providers.google.cloud.sensors.gcs import GCSObjectExistenceSensor" + ) + def __init__( self, *args: Any, @@ -55,6 +60,11 @@ class GCSObjectsWithPrefixExistenceSensorAsync(GCSObjectsWithPrefixExistenceSens and set `deferrable` param to `True` instead. """ + is_deprecated = True + post_deprecation_replacement = ( + "from airflow.providers.google.cloud.sensors.gcs import GCSObjectsWithPrefixExistenceSensor" + ) + def __init__( self, *args: Any, @@ -90,6 +100,11 @@ class GCSUploadSessionCompleteSensorAsync(GCSUploadSessionCompleteSensor): and set `deferrable` param to `True` instead. """ + is_deprecated = True + post_deprecation_replacement = ( + "from airflow.providers.google.cloud.sensors.gcs import GCSUploadSessionCompleteSensor" + ) + def __init__( self, *args: Any, @@ -126,6 +141,11 @@ class GCSObjectUpdateSensorAsync(GCSObjectUpdateSensor): and set `deferrable` param to `True` instead. """ + is_deprecated = True + post_deprecation_replacement = ( + "from airflow.providers.google.cloud.sensors.gcs import GCSObjectUpdateSensor" + ) + def __init__( self, *args: Any, diff --git a/astronomer/providers/http/sensors/http.py b/astronomer/providers/http/sensors/http.py index 73f7869a5..a029718b4 100644 --- a/astronomer/providers/http/sensors/http.py +++ b/astronomer/providers/http/sensors/http.py @@ -11,6 +11,9 @@ class HttpSensorAsync(HttpSensor): and set `deferrable` param to `True` instead. """ + is_deprecated = True + post_deprecation_replacement = "from airflow.providers.http.sensors.http import HttpSensor" + def __init__(self, *args: Any, **kwargs: Any) -> None: warnings.warn( ( diff --git a/astronomer/providers/microsoft/azure/hooks/wasb.py b/astronomer/providers/microsoft/azure/hooks/wasb.py index d837d47dd..0df2736cf 100644 --- a/astronomer/providers/microsoft/azure/hooks/wasb.py +++ b/astronomer/providers/microsoft/azure/hooks/wasb.py @@ -36,9 +36,9 @@ def __init__( ) self.conn_id = wasb_conn_id self.public_read = public_read - self.blob_service_client: BlobServiceClient = self.get_conn() + self.blob_service_client: BlobServiceClient = self.get_conn() # type: ignore[assignment] - def get_conn(self) -> BlobServiceClient: + def get_conn(self) -> BlobServiceClient: # type: ignore[override] """Return the async BlobServiceClient object.""" conn = self.get_connection(self.conn_id) extra = conn.extra_dejson or {} @@ -87,7 +87,7 @@ def get_conn(self) -> BlobServiceClient: **extra, ) - def _get_blob_client(self, container_name: str, blob_name: str) -> BlobClient: + def _get_blob_client(self, container_name: str, blob_name: str) -> BlobClient: # type: ignore[override] """ Instantiate a blob client. @@ -110,7 +110,7 @@ async def check_for_blob_async(self, container_name: str, blob_name: str, **kwar return False return True - def _get_container_client(self, container_name: str) -> ContainerClient: + def _get_container_client(self, container_name: str) -> ContainerClient: # type: ignore[override] """ Instantiate a container client. diff --git a/astronomer/providers/microsoft/azure/operators/data_factory.py b/astronomer/providers/microsoft/azure/operators/data_factory.py index 811948e6c..459c085c4 100644 --- a/astronomer/providers/microsoft/azure/operators/data_factory.py +++ b/astronomer/providers/microsoft/azure/operators/data_factory.py @@ -12,6 +12,9 @@ class AzureDataFactoryRunPipelineOperatorAsync(AzureDataFactoryRunPipelineOperat and set `deferrable` param to `True` instead. """ + is_deprecated = True + post_deprecation_replacement = "from airflow.providers.microsoft.azure.operators.data_factory import AzureDataFactoryRunPipelineOperator" + def __init__(self, *args, **kwargs): # type: ignore[no-untyped-def] warnings.warn( ( diff --git a/astronomer/providers/microsoft/azure/sensors/data_factory.py b/astronomer/providers/microsoft/azure/sensors/data_factory.py index ac9413ac6..6748fca87 100644 --- a/astronomer/providers/microsoft/azure/sensors/data_factory.py +++ b/astronomer/providers/microsoft/azure/sensors/data_factory.py @@ -11,6 +11,9 @@ class AzureDataFactoryPipelineRunStatusSensorAsync(AzureDataFactoryPipelineRunSt instead and set `deferrable` param to `True` instead. """ + is_deprecated = True + post_deprecation_replacement = "from airflow.providers.microsoft.azure.sensors.data_factory import AzureDataFactoryPipelineRunStatusSensor" + def __init__( self, *args: Any, diff --git a/astronomer/providers/microsoft/azure/sensors/wasb.py b/astronomer/providers/microsoft/azure/sensors/wasb.py index b663b953e..cbe0fc9f4 100644 --- a/astronomer/providers/microsoft/azure/sensors/wasb.py +++ b/astronomer/providers/microsoft/azure/sensors/wasb.py @@ -14,6 +14,9 @@ class WasbBlobSensorAsync(WasbBlobSensor): and set `deferrable` param to `True` instead. """ + is_deprecated = True + post_deprecation_replacement = "from airflow.providers.microsoft.azure.sensors.wasb import WasbBlobSensor" + def __init__( self, *args: Any, @@ -48,6 +51,11 @@ class WasbPrefixSensorAsync(WasbPrefixSensor): and set `deferrable` param to `True` instead. """ + is_deprecated = True + post_deprecation_replacement = ( + "from airflow.providers.microsoft.azure.sensors.wasb import WasbPrefixSensor" + ) + def __init__( self, *args: Any, diff --git a/astronomer/providers/sftp/sensors/sftp.py b/astronomer/providers/sftp/sensors/sftp.py index b70ed3cdb..adf1ae837 100644 --- a/astronomer/providers/sftp/sensors/sftp.py +++ b/astronomer/providers/sftp/sensors/sftp.py @@ -11,6 +11,9 @@ class SFTPSensorAsync(SFTPSensor): and set `deferrable` param to `True` instead. """ + is_deprecated = True + post_deprecation_replacement = "from airflow.providers.sftp.sensors.sftp import SFTPSensor" + def __init__( self, *args: Any, diff --git a/astronomer/providers/snowflake/operators/snowflake.py b/astronomer/providers/snowflake/operators/snowflake.py index 35854c346..cf4cd1aef 100644 --- a/astronomer/providers/snowflake/operators/snowflake.py +++ b/astronomer/providers/snowflake/operators/snowflake.py @@ -216,6 +216,11 @@ class SnowflakeSqlApiOperatorAsync(SnowflakeSqlApiOperator): and set `deferrable` param to `True` instead. """ + is_deprecated = True + post_deprecation_replacement = ( + "from airflow.providers.snowflake.operators.snowflake import SnowflakeSqlApiOperator" + ) + def __init__(self, *args: Any, **kwargs: Any): warnings.warn( ( diff --git a/docs/_ext/traverse_operators_sensors.py b/docs/_ext/traverse_operators_sensors.py index 13891b1de..5d21b14e3 100644 --- a/docs/_ext/traverse_operators_sensors.py +++ b/docs/_ext/traverse_operators_sensors.py @@ -1,7 +1,9 @@ +from __future__ import annotations + import ast +import importlib import os from pathlib import Path -from typing import List, Tuple from docutils import nodes from sphinx.util.docutils import SphinxDirective @@ -20,14 +22,15 @@ def collect_elements( directory_path: str, - files: List[str], + files: list[str], element_type: str, - elements_list: List[Tuple[str, str]], + elements_list: list[tuple[str, bool, str, str]], current_module_path: str, ): """ Checks that ``Async`` class definitions exist using ``ast.parse`` in the given files, that those are - ``operators/sensors`` and appends the operator/sensor along with its import path to the given output list. + ``operators/sensors`` and appends the operator/sensor along with its import path and deprecation status to the + given output list. :param directory_path: path of the directory in which the given ``files`` are located :param files: list of files to look for async operator/sensor class definitions @@ -47,7 +50,14 @@ def collect_elements( if isinstance(element, ast.ClassDef): element_name = element.name if element_type in element_name and ASYNC_SUBSTRING in element_name: - elements_list.append((element_name, module_import_path)) + module = importlib.import_module(module_import_path) + cls = getattr(module, element_name) + is_deprecated = bool(getattr(cls, "is_deprecated", False)) + # is_deprecated = "✅" if getattr(cls, "is_deprecated", False) else "❌" + post_deprecation_replacement = str(getattr(cls, "post_deprecation_replacement", "")) + elements_list.append( + (element_name, is_deprecated, module_import_path, post_deprecation_replacement) + ) def search_providers(): @@ -79,17 +89,25 @@ def run(self): """Generates raw html to list the operators and sensors parsed using `ast`.""" operators, sensors = search_providers() operators_html = ( - "

Operators

" "" "" "" "" + "

Operators

" + "
#Operator nameImport path
" + "" + "" + "" + "" ) for index, operator in enumerate(operators, start=1): - class_def_link = operator[1].replace(".", "/") + "/index.html#" + operator[1] + "." + operator[0] + class_def_link = operator[2].replace(".", "/") + "/index.html#" + operator[2] + "." + operator[0] operators_html += ( - f"" - f"" - f"" - f"" - f"" + f"" f"" f"" ) + if operator[1]: + operators_html += "" + operators_html += f"" + else: + operators_html += "" + operators_html += f"" + operators_html += "" # The below script generates the URL for the class definition by extracting the selected doc version from # the current browser URL location. operators_html += ( @@ -101,16 +119,26 @@ def run(self): ) operators_html += "
#Operator nameDeprecatedImport path
{index}{operator[0]}
from {operator[1]} import {operator[0]}
{index}{operator[0]}Old Path:\n
from {operator[2]} import {operator[0]}
\n New Path: \n
{operator[3]}
from {operator[2]} import {operator[0]}

" - sensors_html = "

Sensors

" "" "" "" "" + sensors_html = ( + "

Sensors

" + "
#Sensor nameImport path
" + "" + "" + "" + "" + ) for index, sensor in enumerate(sensors, start=1): - class_def_link = sensor[1].replace(".", "/") + "/index.html#" + sensor[1] + "." + sensor[0] + class_def_link = sensor[2].replace(".", "/") + "/index.html#" + sensor[2] + "." + sensor[0] sensors_html += ( - f"" - f"" - f"" - f"" - f"" + f"" f"" f"" ) + if sensor[1]: + sensors_html += "" + sensors_html += f"" + else: + sensors_html += "" + sensors_html += f"" + sensors_html += "" sensors_html += ( f"
#Sensor nameDeprecatedImport path
{index}{sensor[0]}
from {sensor[1]} import {sensor[0]}
{index}{sensor[0]}Old Path:\n
from {sensor[2]} import {sensor[0]}
\n New Path: \n
{sensor[3]}
from {sensor[2]} import {sensor[0]}