ashb commented on a change in pull request #6601: [AIRFLOW-6010] Remove cyclic 
imports and pylint disables
URL: https://github.com/apache/airflow/pull/6601#discussion_r348377993
 
 

 ##########
 File path: CONTRIBUTING.rst
 ##########
 @@ -509,6 +509,35 @@ You can always skip running the tests by providing 
``--no-verify`` flag to the
 
 To check other usage types of the pre-commit framework, see `Pre-commit 
website <https://pre-commit.com/>`__.
 
+Importing Airflow core objects
+==============================
+
+When you implement core features or DAGs you might need to import some of the 
core objects or modules.
+Since airflow can be used both as application (by internal classes) and as 
library (by DAGs), there are
+different ways those core objects and packages are imported.
+
+Airflow imports some of the core objects directly to 'airflow' package so that 
they can be used from there.
+
+Those criteria were assumed for choosing what import path to use:
+
+* If you work on a core feature inside airflow, you should import the objects 
directly from the package where
+  the object is defined - this minimises the risk of cyclic imports.
+* If you import the objects from any of 'providers' classes, you should import 
the objects from
+  'airflow' or 'airflow.modules', It is very important for back-porting 
operators/hooks/sensors
 
 Review comment:
   ```suggestion
     'airflow' or 'airflow.models', It is very important for back-porting 
operators/hooks/sensors
   ```
   I think?

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