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_r246053027
########## 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'll expand the documentation when I get home, but given a class like ```python # my_package/my_plugin.py from airflow.plugins_manager import AirflowPlugin class MyAirflowPlugin(AirflowPlugin): name = 'my_namespace.MyPlugin' ``` I think (I can't remember off the top of my head, but I will test) that the plugin would be exposed under `airflow.operators.my_namespace.MyPlugin`, `airflow.sensors.my_namespace.MyPluigin`, etc. ---------------------------------------------------------------- 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