Open edX is a very powerful platform and can be extended in many ways. This document describes the best practices that should be used to add new plugin entry points which allow any installed Python library to provide new capabilities.
Open edX uses Stevedore from Open Stack to provide support for plugins. There are a few steps necessary to declare your new entry point:
PluginManager
which code will use to find instances of your pluginsNAMESPACE
for your chosen entry point namespacee.g.
MY_PLUGIN_NAMESPACE = 'my_organization.my_plugin' class MyPluginManager(PluginManager): """ Manager for my plugins. """ NAMESPACE = MY_PLUGIN_NAMESPACE |
In a Python library, a new plugin can be registered in setup.py
e.g.
from setuptools import setup setup( name="My Library", version="1.0", install_requires=["setuptools"], requires=[], entry_points={ "my_organization.my_plugin": [ "first_plugin = my_organization.plugins:FirstPlugin", }, ) |
The platform now can access the plugins in one of two ways:
e.g.
my_plugin = MyPluginManager.get_plugin('first_plugin') |
Typically the platform code will work with the full list of available plugins
This is because, by definition, installed plugins are not known by name to the platform
The Course Blocks API provides a plugin mechanism to allow new transformers to be added.
BlockStructureTransformer
class lives here:TransformerRegistry
is a subclass of PluginManager
GradesTransformer
The tabs shown for a course are defined as plugins, so that features can introduce new ones.
PluginManager
is defined here:CourseTab
classFor more details, see Adding a new course tab.