kyungjunleeme commented on PR #53937: URL: https://github.com/apache/airflow/pull/53937#issuecomment-3148906340
> I am not sure we should do it **now** and even if we do, it should be deprecated. I have not seen any other models removed from this `all` here. What exactly confusion and unintended usage are you talking about ? Thanks for the feedback! You're absolutely right that we should be careful about removing or hiding classes. Let me clarify the intent here: This PR doesn't remove `Operator` from the codebase — it simply avoids exposing it via `airflow.models.__all__`. Currently, `Operator` is already marked as deprecated via `add_deprecated_classes`, and is lazily imported from `airflow.sdk.types.Operator`. However, the fact that it's still present in `__all__` (or would be imported if added) makes it appear like a stable part of our public API, which can cause confusion. `Operator` is not used directly anywhere in the core. It’s more of a type alias for `BaseOperator`, and users should never instantiate or subclass it. We’ve even seen cases internally where new developers are unsure whether to inherit from `Operator` or `BaseOperator`. ----- I understand the concern. Just to clarify — I’m not trying to remove `Operator` entirely, only to avoid exposing it via `__all__`. The motivation is to reduce confusion for contributors or users who are unfamiliar with Airflow internals. For example, IDEs like PyCharm flag the following as a warning: ```python from airflow.models import Operator # 'Operator' is not declared in __all__ <img width="1128" height="172" alt="image" src="https://github.com/user-attachments/assets/e53c8015-4cdd-4af8-8149-24f247b580e8" /> -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
