using setuptools for plugins

Suggestions and discussion of future versions
Post Reply
jorge.vargas
Member
Member
Posts: 14
Joined: Wed Jun 27, 2007 8:50 pm

using setuptools for plugins

Post by jorge.vargas »

hi

I have ported the current plugin system to work with setuptools entry points, I have been working like this for a while and i like it a lot so here is a list:

- the use of python setup.py develop, I love this it fools your python into thinking your code is installed while it isn't
- entry points give a great flexibility in package structure, as long as I have a line in my setup.py that points to a python object (in the general sense, so function,module,class,object,etc apply) my plugin can have whatever layout I want
- you don't need setuptools just pkg_resources which is a lot smaller and is probably going into python before setuptools see http://www.python.org/dev/peps/pep-0365/
- automatic dependencies check, the plugin could say it doesn't works on deluge 0.6 for example
- multiple entry points, we could define different types of plugins, for example I was thinking of 3 algorithms (things that have no gui or just a configure method), ui plugins and web plugins (for the web interface when it's ready)
- added features, see below.

As for compatibility I took a peak at trac http://trac.edgewall.org/browser/tags/t ... der.py#L62 because I know they support egg and non egg plugins and the way they solve it is really nice. So we can implemented that here too, basically the "old" system is left in place it goes something like

Code: Select all

try: 
    import pkg_resources 
except ImportError: 
    pkg_resources = None
and in the loader

Code: Select all

if pkg_resources:
    code to load the egg files
my current patch doesn't supports this approach but modifiying it will be very simple. although I prefer the following.

if we move to a full setuptools plugin system i'll work on two nice tools first what we in TurboGears call "the CogBin" it's a small webapp that aggregates all TurboGears plugins dirrectly from pypi http://turbogears.org/cogbin I know how that works internally I even had some patches into it so I can "port" to to fetch deluge packages.

Second and more interesting I'll work on a plugin installer I was thinking of adding a second tab to the plugin popup that will fetch from the cheseshop the packages and let you install them right from the UI.

so do you like the idea? which way you prefer?
Post Reply