473,671 Members | 2,290 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

A question on plugin design

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
Aug 5 '07 #1
3 1475
Grzegorz SÅ‚odkowicz <je*****@wp.plw rites:
[...]
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
Aug 5 '07 #2
jj*@pobox.com (John J. Lee) writes:
Grzegorz SÅ‚odkowicz <je*****@wp.plw rites:
[...]
>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
Aug 5 '07 #3
John J. Lee a écrit :
jj*@pobox.com (John J. Lee) writes:
>Grzegorz SÅ‚odkowicz <je*****@wp.plw rites:
[...]
>>I'd also be grateful for pointers to a well designed Pythonic plugin
architectur e 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.
Aug 6 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
7182
by: S³awomir Marcinkowski | last post by:
Hello, can someone show use example use smarty pager plugin? {pager rowcount=$LISTDATA.rowcount limit=$LISTDATA.limit txt_first=$L_MORE class_num="fl" class_numon="fl" class_text="fl"} I'm fighing with it for 5 hours, and still don't have any results :( Slawek,Poland
7
1809
by: Reinhold Birkenfeld | last post by:
Hello, another philosophical question: How would you implement a plugin system (for a web-based application)? Conditions are: - One plugin can have one or many "parts" (or "subplugins", or whatever) - Each subplugin has a type - The rest of the plugin interface is dependent on the type
2
2612
by: timtos | last post by:
Hello. I don´t know if this is a totally silly questin because I really don´t know much about the topic. So excuse me if I am wrong. I want to write a plugin for microsoft office. In fact I want to write it for visio. It should be some kind of html exporter (I can´t use the one from microsoft) Of course I could write it in vb(a) but there are two things I don´t like: 1) The user can mess up the program by manipulating the source 2) I...
3
1411
by: JJ | last post by:
Hi all, I'm writing a program that uses plugins to add some functionality. It works as follows: A plugin is a user control with a method getCoordArray(decimal inX, decimal inY, decimal inZ) and a property System.Drawing.Size bestsize. To use the plugin, I need to do the following: 1) import the dll as a reference. 1b) validate the dll: look for the method getCoordArray(decimal inX, decimal inY, decimal inZ) and a property...
2
3062
by: Matt | last post by:
I'm hoping someone can steer me in the right direction to try to do the following: I am developing an application where we receive files from customers. Right now we receive a variety of formats. I was looking at writing some type of base application that would allow me to add-in either new assemblies or plugins, don't know how or which way, for different scenarios. We may just recieve a text file so an assembly would handle...
2
4684
by: Joe_Black | last post by:
Hi all, I want to create an MDI app that allows reporting on XML data files downloaded from the equipment that we manufacture, this MDI app will have several default reports but due to the nature of the data different people will want to see it in different ways. What I would like to do is have several standard reports/graphing MDI Children that come as standard, then allow the user to apply a plugin that will allow them to view their...
3
4373
by: Richard | last post by:
I'd like to build a C# application that has some sort of plugin or additional modules depending on what functionality the client user has requested. The idea is that I have an SQL database table that can be updated from a number of different sources for example: ID Source SomeData == ====== ========= 1 SomeSQLDatabase.dll abc
4
3715
by: Paciente8159 AKA Klayman | last post by:
Hi, I have a couple of doubts reggarding a plugin based application in C++? I want to build a c++ plugin based app. I have searched alot of things in the net but I still don't know how to start this. For example: I want the plugin to be able to expose functions and HANDLES (for synchronization with WaitForSingleObject for example).
0
2010
by: Zeya | last post by:
Situation: Using C#, ASP.Net Requirement: 1. ASP.net application with virtual hosting service. 2. Requires a service that will run every predefined frequency in minutes (2, 30, 100, 10000) defined in web.config and do some data crunching in the database How am I doing this?
0
8390
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8819
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8667
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7428
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6222
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5692
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4222
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2808
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2048
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.