Skip to content

WIP: Plugins

Pierre-Elouan Rethore requested to merge plugins into master

This is a proposal to modify the Topfarm api to deal with plugins. You can check how the mongo_recorder setup.py is configured. With this setup the scenario is that the users could import the plugins in this way:

In a plugin setup.py:
entry_points={'topfarm.plugins': 'MongoRecorder = mongo_recorder.mongo_recorder:MongoRecorder'},
In a topfarm app:
from topfarm.plugins import MongoRecorder

Caveats

With the example I show here, the other classes from the mongo_recorder module are not exposed through Topfarm. Alternatively I could do another entry point like this:

entry_points={'topfarm.plugins': 'mongo_recorder = mongo_recorder.mongo_recorder'},

In this case, however, the import should look like that:

from topfarm.plugins import mongo_recorder
mongo_rec = mongo_recorder.MongoRecorder()

This one will throw an error:

from topfarm.plugins.mongo_recorder import MongoRecorder
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-1-5f936c8f4499> in <module>
----> 1 from topfarm.plugins.mongo_recorder import MongoRecorder

ModuleNotFoundError: No module named 'topfarm.plugins.mongo_recorder'

I think this can be confusing for the users.

Merge request reports