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_r246211748
 
 

 ##########
 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:
   Ah right, i have not used the “name” of the entry point as it is already 
handled by the ‘AirflowPlugin.name’. We could use it, but it seems like a 
precedence would just complicate things.

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