Trivial plugin framework?

Ville Vainio ville at spammers.com
Fri Nov 19 05:45:37 EST 2004


Anyone know any good, low-fat, Open Source (BSD or better) trivial
plugin framework that would allow me to put a bunch of .py-files in a
directory, with contents like:

# /tmp/py/mymod.py

class C:
  pass

class CFact:
  pass

__plugindict__ = {
  'somefactory' : CFact
}


And then do

import plugin

# sees that implementation repository doesn't exist, so creates one by
# looking at all the modules. Having seen that 'somefactory' is in
# mymod.py it only execs that.

fact = plugin.get("/tmp/py", 'somefactory')

obj = fact()

?

It seems easy enough to do, in fact I'm implementing one as I speak
(well, not physically possible but anyway ;-), but I figured there has
to be something that fits the bell better than my would-be
implementation.

-- 
Ville Vainio   http://tinyurl.com/2prnb



More information about the Python-list mailing list