potiuk 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_r383111273
 
 

 ##########
 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:
   I think we also need to disable cyclic dependency pylint check as well

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

Reply via email to