[ 
https://issues.apache.org/jira/browse/AIRFLOW-2847?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16605219#comment-16605219
 ] 

ASF GitHub Bot commented on AIRFLOW-2847:
-----------------------------------------

feng-tao closed pull request #3692: [AIRFLOW-2847] Remove legacy imports 
support for plugins for 2.0 deprecation.
URL: https://github.com/apache/incubator-airflow/pull/3692
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/airflow/hooks/__init__.py b/airflow/hooks/__init__.py
index 38a7dcfebe..1553f3ab56 100644
--- a/airflow/hooks/__init__.py
+++ b/airflow/hooks/__init__.py
@@ -22,75 +22,12 @@
 import sys
 
 
-# ------------------------------------------------------------------------
-#
-# #TODO #FIXME Airflow 2.0
-#
-# Old import machinary below.
-#
-# This is deprecated but should be kept until Airflow 2.0
-# for compatibility.
-#
-# ------------------------------------------------------------------------
-
 # Imports the hooks dynamically while keeping the package API clean,
 # abstracting the underlying modules
 
-
-_hooks = {
-    'base_hook': ['BaseHook'],
-    'hive_hooks': [
-        'HiveCliHook',
-        'HiveMetastoreHook',
-        'HiveServer2Hook',
-    ],
-    'hdfs_hook': ['HDFSHook'],
-    'webhdfs_hook': ['WebHDFSHook'],
-    'pig_hook': ['PigCliHook'],
-    'mysql_hook': ['MySqlHook'],
-    'postgres_hook': ['PostgresHook'],
-    'presto_hook': ['PrestoHook'],
-    'samba_hook': ['SambaHook'],
-    'sqlite_hook': ['SqliteHook'],
-    'S3_hook': ['S3Hook'],
-    'zendesk_hook': ['ZendeskHook'],
-    'http_hook': ['HttpHook'],
-    'druid_hook': [
-        'DruidHook',
-        'DruidDbApiHook',
-    ],
-    'jdbc_hook': ['JdbcHook'],
-    'dbapi_hook': ['DbApiHook'],
-    'mssql_hook': ['MsSqlHook'],
-    'oracle_hook': ['OracleHook'],
-    'slack_hook': ['SlackHook'],
-}
-
-
-if not os.environ.get('AIRFLOW_USE_NEW_IMPORTS', False):
-    from airflow.utils.helpers import AirflowImporter
-    airflow_importer = AirflowImporter(sys.modules[__name__], _hooks)
-
-
 def _integrate_plugins():
     """Integrate plugins to the context"""
     from airflow.plugins_manager import hooks_modules
     for hooks_module in hooks_modules:
         sys.modules[hooks_module.__name__] = hooks_module
         globals()[hooks_module._name] = hooks_module
-
-        ##########################################################
-        # TODO FIXME Remove in Airflow 2.0
-
-        if not os.environ.get('AIRFLOW_USE_NEW_IMPORTS', False):
-            from zope.deprecation import deprecated
-            for _hook in hooks_module._objects:
-                hook_name = _hook.__name__
-                globals()[hook_name] = _hook
-                deprecated(
-                    hook_name,
-                    "Importing plugin hook '{i}' directly from "
-                    "'airflow.hooks' has been deprecated. Please "
-                    "import from 'airflow.hooks.[plugin_module]' "
-                    "instead. Support for direct imports will be dropped "
-                    "entirely in Airflow 2.0.".format(i=hook_name))
diff --git a/airflow/macros/__init__.py b/airflow/macros/__init__.py
index 81782727eb..fdd64f88a6 100644
--- a/airflow/macros/__init__.py
+++ b/airflow/macros/__init__.py
@@ -74,20 +74,3 @@ def _integrate_plugins():
     for macros_module in macros_modules:
         sys.modules[macros_module.__name__] = macros_module
         globals()[macros_module._name] = macros_module
-
-        ##########################################################
-        # TODO FIXME Remove in Airflow 2.0
-
-        import os
-        if not os.environ.get('AIRFLOW_USE_NEW_IMPORTS', False):
-            from zope.deprecation import deprecated
-            for _macro in macros_module._objects:
-                macro_name = _macro.__name__
-                globals()[macro_name] = _macro
-                deprecated(
-                    macro_name,
-                    "Importing plugin macro '{i}' directly from "
-                    "'airflow.macros' has been deprecated. Please "
-                    "import from 'airflow.macros.[plugin_module]' "
-                    "instead. Support for direct imports will be dropped "
-                    "entirely in Airflow 2.0.".format(i=macro_name))
diff --git a/airflow/operators/__init__.py b/airflow/operators/__init__.py
index f732d8f8a8..51715bc8e7 100644
--- a/airflow/operators/__init__.py
+++ b/airflow/operators/__init__.py
@@ -90,19 +90,3 @@ def _integrate_plugins():
     for operators_module in operators_modules:
         sys.modules[operators_module.__name__] = operators_module
         globals()[operators_module._name] = operators_module
-
-        ##########################################################
-        # TODO FIXME Remove in Airflow 2.0
-
-        if not os.environ.get('AIRFLOW_USE_NEW_IMPORTS', False):
-            from zope.deprecation import deprecated
-            for _operator in operators_module._objects:
-                operator_name = _operator.__name__
-                globals()[operator_name] = _operator
-                deprecated(
-                    operator_name,
-                    "Importing plugin operator '{i}' directly from "
-                    "'airflow.operators' has been deprecated. Please "
-                    "import from 'airflow.operators.[plugin_module]' "
-                    "instead. Support for direct imports will be dropped "
-                    "entirely in Airflow 2.0.".format(i=operator_name))
diff --git a/airflow/sensors/__init__.py b/airflow/sensors/__init__.py
index 5036251d66..5409eb12e4 100644
--- a/airflow/sensors/__init__.py
+++ b/airflow/sensors/__init__.py
@@ -47,19 +47,3 @@ def _integrate_plugins():
     for sensors_module in sensors_modules:
         sys.modules[sensors_module.__name__] = sensors_module
         globals()[sensors_module._name] = sensors_module
-
-        ##########################################################
-        # TODO FIXME Remove in Airflow 2.0
-
-        if not os.environ.get('AIRFLOW_USE_NEW_IMPORTS', False):
-            from zope.deprecation import deprecated
-            for _sensor in sensors_module._objects:
-                sensor_name = _sensor.__name__
-                globals()[sensor_name] = _sensor
-                deprecated(
-                    sensor_name,
-                    "Importing plugin operator '{i}' directly from "
-                    "'airflow.operators' has been deprecated. Please "
-                    "import from 'airflow.operators.[plugin_module]' "
-                    "instead. Support for direct imports will be dropped "
-                    "entirely in Airflow 2.0.".format(i=sensor_name))


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Remove deprecated plugin import support
> ---------------------------------------
>
>                 Key: AIRFLOW-2847
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-2847
>             Project: Apache Airflow
>          Issue Type: Improvement
>    Affects Versions: 2.0.0
>            Reporter: holdenk
>            Assignee: holdenk
>            Priority: Major
>
> As stated in the TODOs in macros,sensors, etc. we should remove the old 
> import mechanism for 2.0 since its been deprecated with 2.0 as the slated 
> removal time-frame.
>  
> Note: I made the issue "Major" but it _might_ be a blocker but since it's 
> listed as to be removed in 2.0, but I'm not familiar enough with whats 
> consider blockers on this project to do that.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to