Skip to content

Conversation

@Dev-iL
Copy link
Collaborator

@Dev-iL Dev-iL commented Jul 27, 2025

Fixing some deprecations reported by breeze:

{"category": "DeprecationWarning", "message": "The `airflow.models.baseoperator.BaseOperator` attribute is deprecated. Please use `'airflow.sdk.bases.operator.BaseOperator'`.", "filename": "devel-common/src/tests_common/test_utils/mock_operators.py", "lineno": 24, "when": "collect", "node_id": null, "param_id": null, "group": "other", "count": 1}
{"category": "DeprecationWarning", "message": "The `airflow.models.baseoperator.BaseOperator` attribute is deprecated. Please use `'airflow.sdk.bases.operator.BaseOperator'`.", "filename": "airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_task_instances.py", "lineno": 37, "when": "collect", "node_id": null, "param_id": null, "group": "tests", "count": 1}
{"category": "DeprecationWarning", "message": "The `airflow.models.baseoperator.BaseOperator` attribute is deprecated. Please use `'airflow.sdk.bases.operator.BaseOperator'`.", "filename": "devel-common/src/tests_common/test_utils/mock_operators.py", "lineno": 24, "when": "runtest", "node_id": "airflow-core/tests/unit/callbacks/test_callback_requests.py::TestCallbackRequest::test_from_json", "param_id": "None-TaskCallbackRequest", "group": "other", "count": 1}
{"category": "DeprecationWarning", "message": "The `airflow.utils.timezone.coerce_datetime` attribute is deprecated. Please use `'airflow.sdk.timezone.coerce_datetime'`.", "filename": "providers/standard/src/airflow/providers/standard/sensors/time.py", "lineno": 93, "when": "runtest", "node_id": "airflow-core/tests/unit/callbacks/test_callback_requests.py::TestCallbackRequest::test_from_json", "param_id": "None-TaskCallbackRequest", "group": "providers", "count": 4}
{"category": "DeprecationWarning", "message": "The `airflow.utils.timezone.convert_to_utc` attribute is deprecated. Please use `'airflow.sdk.timezone.convert_to_utc'`.", "filename": "providers/standard/src/airflow/providers/standard/sensors/time.py", "lineno": 100, "when": "runtest", "node_id": "airflow-core/tests/unit/callbacks/test_callback_requests.py::TestCallbackRequest::test_from_json", "param_id": "None-TaskCallbackRequest", "group": "providers", "count": 4}
{"category": "DeprecationWarning", "message": "The `airflow.utils.timezone.datetime` attribute is deprecated. Please use `'airflow.sdk.timezone.datetime'`.", "filename": "airflow-core/src/airflow/example_dags/standard/example_external_task_parent_deferrable.py", "lineno": 23, "when": "runtest", "node_id": "airflow-core/tests/unit/callbacks/test_callback_requests.py::TestCallbackRequest::test_from_json", "param_id": "None-TaskCallbackRequest", "group": "other", "count": 1}
{"category": "DeprecationWarning", "message": "The `airflow.models.baseoperator.BaseOperator` attribute is deprecated. Please use `'airflow.sdk.bases.operator.BaseOperator'`.", "filename": "providers/standard/src/airflow/providers/standard/operators/hitl.py", "lineno": 32, "when": "runtest", "node_id": "airflow-core/tests/unit/callbacks/test_callback_requests.py::TestCallbackRequest::test_from_json", "param_id": "None-TaskCallbackRequest", "group": "providers", "count": 1}

CC: @amoghrajesh


^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in airflow-core/newsfragments.

Copilot AI review requested due to automatic review settings July 27, 2025 09:55
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes several deprecation warnings related to the transition from legacy Airflow modules to the new airflow.sdk package structure. The changes update import statements to use the recommended SDK modules instead of the deprecated legacy modules.

Key changes:

  • Update imports for BaseOperator from airflow.models.baseoperator to airflow.sdk.bases.operator
  • Update timezone-related imports from airflow.utils.timezone to airflow.sdk.timezone
  • Add version compatibility checks to conditionally import from the appropriate module based on Airflow version

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
providers/standard/src/airflow/providers/standard/sensors/time.py Updates timezone import to use SDK module
providers/standard/src/airflow/providers/standard/operators/hitl.py Updates BaseOperator import to use SDK module
providers/standard/src/airflow/providers/standard/example_dags/example_external_task_parent_deferrable.py Updates datetime import to use SDK timezone module
devel-common/src/tests_common/test_utils/mock_operators.py Adds version compatibility for BaseOperator import with conditional logic
airflow-core/tests/unit/cli/commands/test_dag_command.py Adds version compatibility for BaseOperator import with conditional logic

@potiuk
Copy link
Member

potiuk commented Jul 27, 2025

There are some errors though :(

@Dev-iL Dev-iL force-pushed the Dev-iL/2507/fix_sdk_deprecations branch 5 times, most recently from ccf63fe to fb4799f Compare July 28, 2025 18:48
@Dev-iL
Copy link
Collaborator Author

Dev-iL commented Jul 28, 2025

Fixed now!

Copy link
Contributor

@amoghrajesh amoghrajesh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Dev-iL thanks for working on this, a general set of comments that apply throughout the PR.

@Dev-iL Dev-iL force-pushed the Dev-iL/2507/fix_sdk_deprecations branch from fb4799f to 00325ad Compare July 29, 2025 16:23
@Dev-iL Dev-iL requested a review from mobuchowski as a code owner July 29, 2025 16:23
@Dev-iL Dev-iL force-pushed the Dev-iL/2507/fix_sdk_deprecations branch 5 times, most recently from 555f0a9 to be17494 Compare August 1, 2025 15:04
+ Some ruff violations related to the performance tests.
@Dev-iL Dev-iL force-pushed the Dev-iL/2507/fix_sdk_deprecations branch from be17494 to 8568091 Compare August 2, 2025 06:23
@potiuk potiuk merged commit 7aa0704 into apache:main Aug 2, 2025
190 checks passed
@Dev-iL Dev-iL deleted the Dev-iL/2507/fix_sdk_deprecations branch August 2, 2025 08:35
ferruzzi pushed a commit to aws-mwaa/upstream-to-airflow that referenced this pull request Aug 7, 2025
+ Some ruff violations related to the performance tests.
fweilun pushed a commit to fweilun/airflow that referenced this pull request Aug 11, 2025
+ Some ruff violations related to the performance tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants