nuclearpinguin commented on a change in pull request #7517: [AIRFLOW-6817] Lazy-load `airflow.DAG` to keep user-facing API untouched URL: https://github.com/apache/airflow/pull/7517#discussion_r383119737
########## File path: airflow/__init__.py ########## @@ -42,3 +42,22 @@ login: Optional[Callable] = None integrate_plugins() + +__all__ = ['__version__', 'login', 'DAG'] + + +def __getattr__(name): + # PEP-562: Lazy loaded attributes on python modules + if name == "DAG": + from airflow.models.dag import DAG # pylint: disable=redefined-outer-name Review comment: Worth to try but I have a feeling that this has to be disabled in all places where the cycle occurs. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
