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 2021/02/23 20:35:27 UTC

[GitHub] [airflow] digitalsimboja commented on a change in pull request #14400: Fix conf import from airflow #13945

digitalsimboja commented on a change in pull request #14400:
URL: https://github.com/apache/airflow/pull/14400#discussion_r581369316



##########
File path: airflow/upgrade/rules/fix_conf_not_importable_from_airflow.py
##########
@@ -0,0 +1,29 @@
+
+from airflow.upgrade.rules.base_rule import BaseRule
+
+print(BaseRule)
+
+<<<<<<< HEAD
+
+class ConfImportFromAirflow(BaseRule):
+    """
+      ConfImportFromAirflow class to ensure proper import of conf from to work in Airflow 2.0
+      """
+    title = "Properly import conf from Airflow"
+    description = """\
+    In Airflow-2.0, it's not possible to import conf from airflow by using \'import conf from airflow\'
+    To ensure your code works in Airflow 2.0, you should use \'from airflow.Configuration import conf \'
+                      """
+
+    def check(self):
+        from airflow import conf
+        if conf:
+            return (
+                "Warning: Properly import conf to ensure your code works in AIrflow 2.0"
+                "From Airflow 2.0, you should use from airflow.Configuration import conf."
+            )

Review comment:
       Got it. Thanks




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