Skip to content

Conversation

@amoghrajesh
Copy link
Contributor

The final step of cleanup of utils.xcom: #53065

As a follow up, I will wipe of utils.xcom by adding deprecation warnings.


^ 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.

@amoghrajesh amoghrajesh requested review from ashb, eladkal, kaxil and potiuk July 11, 2025 08:05
@amoghrajesh amoghrajesh changed the title Replace usages of XCOM_RETURN_KEY in providers to not be from utils Replace usages of XCOM_RETURN_KEY in providers to not be from utils Jul 11, 2025
@amoghrajesh amoghrajesh self-assigned this Jul 11, 2025
@amoghrajesh amoghrajesh added this to the Airflow 3.1.0 milestone Jul 11, 2025
@potiuk potiuk merged commit 8b3ba00 into apache:main Jul 11, 2025
107 checks passed
Comment on lines +57 to +64
__all__ = [
"AIRFLOW_V_3_0_PLUS",
"AIRFLOW_V_3_0_1",
"AIRFLOW_V_3_1_PLUS",
"SQLALCHEMY_V_1_4",
"SQLALCHEMY_V_2_0",
"XCOM_RETURN_KEY",
]
Copy link
Member

Choose a reason for hiding this comment

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

Instead of adding this (which is also missing the fns etc) change the import to from ... import XCOM_RETURN_KEY as XCOM_RETURN_KEY - that should remove the unused import warning

AIRFLOW_V_3_1_PLUS = get_base_airflow_version_tuple() >= (3, 1, 0)

if AIRFLOW_V_3_1_PLUS:
from airflow.models.xcom import XCOM_RETURN_KEY
Copy link
Member

Choose a reason for hiding this comment

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

If we're changing this, it's should be changed to use something from sdk, not core.

Also this reminds me- the airflow version check in providers needs to go soon too - we ideally want to "duck type" off what we can I the sdk (i.e. try import except)

Copy link
Member

Choose a reason for hiding this comment

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

Also this reminds me- the airflow version check in providers needs to go soon too - we ideally want to "duck type" off what we can I the sdk (i.e. try import except)

Question: are we going to have task-sdk installable also in Airflow 2 or is it going to be optional dependency of providers? Currently it's not that's why have all the "ifs" and they have to be part of provider's code - so such a version check in sdk will only be really possible to remove from providers if task-sdk is also installable on Airflow 2.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It shouldn't be installable in AF2 and if adding an optional dep in providers is what leads to, I think we should.

from airflow.sensors.base import BaseSensorOperator # type: ignore[no-redef]

if AIRFLOW_V_3_1_PLUS:
from airflow.models.xcom import XCOM_RETURN_KEY
Copy link
Member

Choose a reason for hiding this comment

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

Ditto - sdk please

Copy link
Contributor Author

Choose a reason for hiding this comment

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

PR: #53180

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.

3 participants