473,396 Members | 2,109 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 1460
Grzegorz SÅ‚odkowicz <je*****@wp.plwrites:
[...]
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.plwrites:
[...]
>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.plwrites:
[...]
>>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.
Aug 6 '07 #4

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

Similar topics

1
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...
7
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...
2
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...
3
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...
2
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...
2
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...
3
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...
4
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...
0
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)...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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,...

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.