drewsonne commented on a change in pull request #4412: [AIRFLOW-3605] Load 
plugins from entry_points
URL: https://github.com/apache/airflow/pull/4412#discussion_r246053872
 
 

 ##########
 File path: docs/plugins.rst
 ##########
 @@ -220,3 +220,26 @@ Note on role based views
 Airflow 1.10 introduced role based views using FlaskAppBuilder. You can 
configure which UI is used by setting
 rbac = True. To support plugin views and links for both versions of the UI and 
maintain backwards compatibility,
 the fields appbuilder_views and appbuilder_menu_items were added to the 
AirflowTestPlugin class.
+
+
+Plugins as Python packages
+--------------------------
+
+It is possible to load plugins via `setuptools' 
entrypoint<https://packaging.python.org/guides/creating-and-discovering-plugins/#using-package-metadata>`_
 mechanism. To do this link
+your plugin using an entrypoint in your package. If the package is installed, 
airflow
+will automatically load the registered plugins from the entrypoint list.
+
+.. code-block:: python
+
+    from setuptools import setup
+
+    setup(
+        name="my-package",
+        ...
+        entry_points = {
+            'airflow.plugins': [
+                'my_plugin = my_package.my_plugin:MyAirflowPlugin'
+            ]
+        }
+    )
+
 
 Review comment:
   I'd write some test cases for this functionality, but it is a bit difficult 
given the structure of this file. Would there be objection to wrapping this 
functionality in some functions as I did with `is_valid_plugin(...)` to make 
this a bit easier to test?

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


With regards,
Apache Git Services

Reply via email to