You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2019/11/20 09:39:03 UTC

[GitHub] [airflow] ashb commented on a change in pull request #6601: [AIRFLOW-6010] Remove cyclic imports and pylint disables

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:
users@infra.apache.org


With regards,
Apache Git Services