[ckan-dev] ordering of plugins

David Read david.read at okfn.org
Tue May 31 16:47:32 UTC 2011


Hi folks,

David Raznick and I have been discussing CKAN plugins and worrying
about the order that they run in. I've done a bit of digging and have
added a section to the plugin docs - see below. In summary, the order
is the same for every run, and is determinable, although alphabetical
is not ideal and may need improving on in the future.

David

Ordering of extensions
~~~~~~~~~~~~~~~~~~~~~~

.. caution ::

  The order that extensions are initially loaded is **different** to
the order that their plugins are run.

The order that extensions are initially loaded is as follows:

1. System plugins (in setup.py under ``ckan.system_plugins``).

2. In order of the plugins specified in the config file: ``plugins =``.

3. If more than one module has a plug-in with the same name specified
in the config, then all those are loaded, in the order the modules
appear in ``sys.path``.

The order that a plugins are run in, for example the order that
IRoutes extensions have their ``before_map`` method run, is
alphabetical by the plugin class.

e.g. here is the order for these four extensions: ``<Plugin
DguInventoryPlugin>``, ``<Plugin FormApiPlugin>``, ``<Plugin
StatsPlugin>``, ``<Plugin WalesThemePlugin>``

(This alphabetical ordering is done by
``pyutilib.component.core:ExtensionPoint.extensions()``)




More information about the ckan-dev mailing list