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 2020/06/26 14:14:59 UTC

[GitHub] [airflow] mik-laj commented on a change in pull request #9531: Support .airflowignore for plugins : .pluginingore

mik-laj commented on a change in pull request #9531:
URL: https://github.com/apache/airflow/pull/9531#discussion_r446210550



##########
File path: airflow/plugins_manager.py
##########
@@ -164,8 +163,28 @@ def load_plugins_from_plugin_directory():
     global plugins  # pylint: disable=global-statement
     log.debug("Loading plugins from directory: %s", settings.PLUGINS_FOLDER)
 
+    patterns_by_dir: Dict[str, List[Pattern[str]]] = {}
+
     # Crawl through the plugins folder to find AirflowPlugin derivatives
-    for root, _, files in os.walk(settings.PLUGINS_FOLDER, followlinks=True):  # noqa # pylint: disable=too-many-nested-blocks
+    for root, dirs, files in os.walk(settings.PLUGINS_FOLDER, followlinks=True):  # noqa # pylint: disable=too-many-nested-blocks
+
+        patterns: List[Pattern[str]] = patterns_by_dir.get(root, [])
+        ignore_file = os.path.join(root, '.pluginignore')
+
+        if os.path.isfile(ignore_file):
+            with open(ignore_file, 'r') as file:

Review comment:
       Hello.
   This code looks very similar to:
   https://github.com/apache/airflow/blob/master/airflow/utils/file.py#L125
   I think you can make a generator that will take the starting path and yield for each file to load. 
   Best regards,
   Kamil




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