Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > A question on plugin design

Reply
Thread Tools

A question on plugin design

 
 
=?UTF-8?B?R3J6ZWdvcnogU8WCb2Rrb3dpY3o=?=
Guest
Posts: n/a
 
      08-05-2007
I'm working on my little project (an IM client) which I wanted to
support plugins. My idea was that the core program would by itself do
virtually nothing but manage plugins and all functionality would be
provided by the plugins themselves (including protocol handling and UI.
My first attempt was to check a directory for *.py files, execfile()
them and rely on them to call a method to register a plugin object. This
approach led to some conundrums and I discarded the it as bad design. My
second take was to __import__() from each plugin file the plugin object
and append it to a list of all plugins. But, this way I have to put
imports into the __init__() of the plugin object or else they have no
effect. Is this a valid approach? I'm starting to think that such
problems are again symptoms of poor design.

I'd also be grateful for pointers to a well designed Pythonic plugin
architecture but I'd much prefer a small project with a simple API.

TIA,
Greg Slodkowicz
 
Reply With Quote
 
 
 
 
John J. Lee
Guest
Posts: n/a
 
      08-05-2007
Grzegorz Słodkowicz <(E-Mail Removed)> writes:
[...]
> I'd also be grateful for pointers to a well designed Pythonic plugin
> architecture but I'd much prefer a small project with a simple API.


Google for setuptools and Python eggs. Search for "entry point" on
the setuptools page.


John
 
Reply With Quote
 
 
 
 
John J. Lee
Guest
Posts: n/a
 
      08-05-2007
http://www.velocityreviews.com/forums/(E-Mail Removed) (John J. Lee) writes:

> Grzegorz Słodkowicz <(E-Mail Removed)> writes:
> [...]
>> I'd also be grateful for pointers to a well designed Pythonic plugin
>> architecture but I'd much prefer a small project with a simple API.

>
> Google for setuptools and Python eggs. Search for "entry point" on
> the setuptools page.


And as an example of a project that uses that plugin system, look at
the nose testing tool (I suggest looking at version 0.10, not version
0.9):

http://code.google.com/p/python-nose/


John
 
Reply With Quote
 
Bruno Desthuilliers
Guest
Posts: n/a
 
      08-06-2007
John J. Lee a écrit :
> (E-Mail Removed) (John J. Lee) writes:
>
>> Grzegorz Słodkowicz <(E-Mail Removed)> writes:
>> [...]
>>> I'd also be grateful for pointers to a well designed Pythonic plugin
>>> architecture but I'd much prefer a small project with a simple API.

>> Google for setuptools and Python eggs. Search for "entry point" on
>> the setuptools page.

>
> And as an example of a project that uses that plugin system, look at
> the nose testing tool


And at Trac too.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Eclipse Plugin: how to modify perl build path from an eclipse Plugin java class eser@libero.it Java 1 09-07-2007 09:45 PM
Getting reference of eclipse plugin view or its component from another eclipse plugin view? Jimmy Java 0 03-15-2007 11:04 PM
tomcat-maven-plugin problem - mvn is looking for org.apache.maven.plugins:maven-tomcat-plugin Marcin Cenkier Java 1 04-12-2006 08:00 PM
Detect if Sun plugin is installed (in IE) EVEN if not set as default in plugin? PilotYid Java 1 10-31-2005 11:13 AM
how to design plugin functionality Florian Weber Ruby 7 06-17-2004 02:04 AM



Advertisments