plugin / intra process communication system

Florian Ludwig dino at phidev.org
Tue Feb 16 14:50:39 EST 2010


On Tue, 2010-02-16 at 16:14 +0100, Paul Kölle wrote:
> Am 15.02.2010 23:12, schrieb Florian Ludwig:
> > On Sun, 2010-02-14 at 18:47 +0100, Diez B. Roggisch wrote:
> >> [...]
> >> And then of course, this is not really needed. In Python, behavior
> >> counts, not type-information. So you can get away without any
> >> explicit
> >> declared interface. You might chose to not do that, for aestetic
> >> reasons, or better documentation. But you aren't forced.
> >
> > Actually some plugin-systems in python do force you and they check 
> > if your "implementation" comply with the "interface".

> Which is a good thing IMO ;)

Type checking might be good but not pythonic - imo. The problem with
having interfaces needed to be declared (and therefore the possibility
to check) is as I outlined in my first mail:
 Where to put those interface descriptions if you want both sides
pluggable? You probably end up depending on other modules/projects just
to import the interfaces.

> > Here is one solution I came up with.
> [...]
> Can you post working code? It's not clear what "pbus" is and how it
> works.

Oh, sorry. The idea is similar to "d-bus" - hence the name. Its "the
communcation system". The code is pretty simple and quick. Please
remember its just to show of the concept not to use it in any production
software or anything.

Instead of using classes as connecting-piece I thought using strings
(maybe path "/plugin/wiki" or "org.example.wiki") might solve my
problem. It might be possible to add optional interface validation
though.


pbus.py - just a simple concept implementation of a framework
http://dpaste.com/hold/159980/

auth_openid.py - providing the authentication service
http://dpaste.com/hold/159619/

wiki.py - providing the wiki
http://dpaste.com/hold/159634/

Now putting both together:

> import pbus
>
> import wiki
> import auth_openid
> # or: import auth_shibboleth
>
> pbus.get("wiki").run()



-- 
Florian Ludwig <dino at phidev.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
URL: <http://mail.python.org/pipermail/python-list/attachments/20100216/40b06c06/attachment-0001.sig>


More information about the Python-list mailing list