473,881 Members | 1,739 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

plugin development best practices

Hi,

Nowadays the addition of functionality to programs by means of
plugins is very frequent.

I want to know the opinions of experienced Python developers about the
best practices when it comes to developing a plugin system for a
Python package.

Should plugins be modules in a separate package?
Should there be a registry of available plugins? how would such a
registry be implemented? etc.

thanks,

Flávio

Feb 22 '07 #1
8 2035
Flavio wrote:
Hi,

Nowadays the addition of functionality to programs by means of
plugins is very frequent.

I want to know the opinions of experienced Python developers about the
best practices when it comes to developing a plugin system for a
Python package.

Should plugins be modules in a separate package?
Should there be a registry of available plugins? how would such a
registry be implemented? etc.
There have been a gazillion discussions about this on this newsgroup/mailing
list. Searching the archives will get you to them.

The dynamic nature of python makes a whole range of options available.
Depending on what you want to do (how are the plugins made available and so
on), one or the other might be preferable.

One relatively current development is the usage of setuptools "entry-points"
feature, which is precisely made for discovering installed plugins:

http://peak.telecommunity.com/DevCen...es-and-plugins
Diez
Feb 22 '07 #2
On Feb 22, 11:00 am, "Diez B. Roggisch" <d...@nospam.we b.dewrote:
Flavio wrote:
Hi,
Nowadays the addition of functionality to programs by means of
plugins is very frequent.
I want to know the opinions of experienced Python developers about the
best practices when it comes to developing a plugin system for a
Python package.
Should plugins be modules in a separate package?
Should there be a registry of available plugins? how would such a
registry be implemented? etc.

There have been a gazillion discussions about this on this newsgroup/mailing
list. Searching the archives will get you to them.

The dynamic nature of python makes a whole range of options available.
Depending on what you want to do (how are the plugins made available and so
on), one or the other might be preferable.

One relatively current development is the usage of setuptools "entry-points"
feature, which is precisely made for discovering installed plugins:

http://peak.telecommunity.com/DevCen...mic-discovery-...

Diez
Thanks Diez,

I will search the archives. I am aware of the setuptools feature It is
quite nice. But the documentation is not very clear on how to define
"entry point groups" on the importing end, i.e. how to prepare a an
application to accept plugins it doesn't even now exist.

Flavio

Feb 22 '07 #3
>
I will search the archives. I am aware of the setuptools feature It is
quite nice. But the documentation is not very clear on how to define
"entry point groups" on the importing end, i.e. how to prepare a an
application to accept plugins it doesn't even now exist.
The entry-points are just a method of discovery. Writing a plugin by
itself - if that is what you are talking about here - is usually done by
exposing a certain interface, and invoking some registration
functionality - after the plugin is discovered, that is.
Diez
Feb 22 '07 #4
On Feb 22, 11:01 am, Jean-Paul Calderone <exar...@divmod .comwrote:
On 22 Feb 2007 04:53:02 -0800, Flavio <fccoe...@gmail .comwrote:
Hi,
Nowadays the addition of functionality to programs by means of
plugins is very frequent.
I want to know the opinions of experienced Python developers about the
best practices when it comes to developing a plugin system for a
Python package.
Should plugins be modules in a separate package?
Should there be a registry of available plugins? how would such a
registry be implemented? etc.
thanks,

Best practice may be to not develop a new plugin system. There are quitea
few available already. Most likely, at least one of them is suitable foryour
application.

Here are a couple starting points:

http://twistedmatrix.com/projects/co...to/plugin.html

http://peak.telecommunity.com/DevCen...mic-discovery-...

Jean-Paul
The plugin system provided by twisted looks interesting (though not as
simple as it could be, IMHO). Its main problem is that it introduces
two dependencies : Twisted plugin and ZopeInterface. I think a
functional plugin system could(and should) be done using only the
standard library.

Flávio

Feb 22 '07 #5
On Feb 22, 10:53 am, "Flavio" <fccoe...@gmail .comwrote:
Hi,

Nowadays the addition of functionality to programs by means of
plugins is very frequent.

I want to know the opinions of experienced Python developers about the
best practices when it comes to developing apluginsystemfo r a
Python package.

Should plugins be modules in a separate package?
Should there be a registry of available plugins? how would such a
registry be implemented? etc.

thanks,

Flávio
let me extend my original question with an example:

Simple plugin system proposal:

have a package (directory with __init__.py) called plugins where the
actual plugins are modules in this directory.

When the main script imports the plugins package, all plugin modules
would be available as plugins.pluginA , plugins.pluginB , etc.

A registry of available plugins would be available as a simple
dir(plugins).

code in the main script than wished to use a given plugin, would only
have to look in the registry before calling any code from a given
plugin.

What is wrong/missing with this simple framework?

I'd appreciate any comments.

Flávio

Feb 22 '07 #6
Simple plugin system proposal:
>
have a package (directory with __init__.py) called plugins where the
actual plugins are modules in this directory.

When the main script imports the plugins package, all plugin modules
would be available as plugins.pluginA , plugins.pluginB , etc.

A registry of available plugins would be available as a simple
dir(plugins).

code in the main script than wished to use a given plugin, would only
have to look in the registry before calling any code from a given
plugin.

What is wrong/missing with this simple framework?
Nothing wrong. It's just one way of doing it. But it requires you to have
all plugins being part of one module, in one location. Depending on what
you want to do, this won't suffice. For example if your app is installed in
a system path you aren't supposed to write to - how do you install your
individual plugin? easy_install allows you to install to a folder that is
contained in the PYTHONPATH, and then you can discover entrypoints.

But please, do as we suggested: read the past discussions.

Depending on what _you_ actually want to accomplish, you're proposal is
enough. But don't expect it to become the "one plugin system to rule them
all"-solution.

diez
Feb 22 '07 #7
On Feb 22, 12:36 pm, "Diez B. Roggisch" <d...@nospam.we b.dewrote:
Simple plugin system proposal:
have a package (directory with __init__.py) called plugins where the
actual plugins are modules in this directory.
When the main script imports the plugins package, all plugin modules
would be available as plugins.pluginA , plugins.pluginB , etc.
A registry of available plugins would be available as a simple
dir(plugins).
code in the main script than wished to use a given plugin, would only
have to look in the registry before calling any code from a given
plugin.
What is wrong/missing with this simple framework?

Nothing wrong. It's just one way of doing it. But it requires you to have
all plugins being part of one module, in one location. Depending on what
you want to do, this won't suffice. For example if your app is installed in
a system path you aren't supposed to write to - how do you install your
individual plugin? easy_install allows you to install to a folder that is
contained in the PYTHONPATH, and then you can discover entrypoints.

But please, do as we suggested: read the past discussions.

Depending on what _you_ actually want to accomplish, you're proposal is
enough. But don't expect it to become the "one plugin system to rule them
all"-solution.

diez
Oh, I have read all the links that have been suggested, but I am
looking for the simplest possible solution.

I have no intention to create the "next Plugin system" I am just
trying to solve my own problem and in the process leave a record of a
fruitfull discussion about plugin systems.

BTW I have yet to check TRAC's plugin system.

Feb 22 '07 #8
On Feb 22, 12:51 pm, "Flavio" <fccoe...@gmail .comwrote:
On Feb 22, 12:36 pm, "Diez B. Roggisch" <d...@nospam.we b.dewrote:
Simple plugin system proposal:
have a package (directory with __init__.py) called plugins where the
actual plugins are modules in this directory.
When the main script imports the plugins package, all plugin modules
would be available as plugins.pluginA , plugins.pluginB , etc.
A registry of available plugins would be available as a simple
dir(plugins).
code in the main script than wished to use a given plugin, would only
have to look in the registry before calling any code from a given
plugin.
What is wrong/missing with this simple framework?
Nothing wrong. It's just one way of doing it. But it requires you to have
all plugins being part of one module, in one location. Depending on what
you want to do, this won't suffice. For example if your app is installed in
a system path you aren't supposed to write to - how do you install your
individual plugin? easy_install allows you to install to a folder that is
contained in the PYTHONPATH, and then you can discover entrypoints.
But please, do as we suggested: read the past discussions.
Depending on what _you_ actually want to accomplish, you're proposal is
enough. But don't expect it to become the "one plugin system to rule them
all"-solution.
diez

Oh, I have read all the links that have been suggested, but I am
looking for the simplest possible solution.

I have no intention to create the "next Plugin system" I am just
trying to solve my own problem and in the process leave a record of a
fruitfull discussion about plugin systems.

BTW I have yet to check TRAC's plugin system.
I have look at Trac's component based pluging system and I liked it
very much. If external dependencies is not an issue I believe this is
the best solution.
http://trac.edgewall.org/wiki/TracPlugins

Feb 22 '07 #9

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

Similar topics

0
1881
by: David Levine | last post by:
This is a lengthy post; please bear with me... This will be a large system with dozens of plugins. In addition to plugins developed internally there will be 3rd parties that will write their own and integrate them into our application. I will be managing the identification and loading of these plugins. In addition, there are a number of assemblies that plugins will reference, some shared, and others private. There are a couple of...
1
4519
by: vertigo | last post by:
Hello Is it possible to write winamp plugin in C# ? Does anybody know sources written in C# and working ? Thanx Michal
2
1833
by: Amelyan | last post by:
Could anyone recommend a book (or a web site) that defines best practices in ASP.NET application development? E.g. 1) Precede your control id's with type of control btnSubmit, txtName, etc. 2) Group relevant .aspx files into subfolders within your project etc.
4
2634
by: Collin Peters | last post by:
I have searched the Internet... but haven't found much relating to this. I am wondering on what the best practices are for migrating a developmemnt database to a release database. Here is the simplest example of my situation (real world would be more complex). Say you have two versions of your application. A release version and a development version. After a month of developing you are ready to release a new version. There have...
10
1702
by: RBD | last post by:
Hi all, I am a a self taught C# programmer. I have been developing custom apps for a few years now, but they have mostly been very small apps for individuals or departments. Now I am getting into fairly large custom apps for small/medium sized companies. My problem is I have been ok with the small apps, but I dont know how to structure large apps. I need resources that will teach me how to structure medium sized applications. I'm...
1
1663
by: Pablo | last post by:
Hello all, Hope today finds you well. I'm looking to take my knowledge of best practices within the development lifecycle to the next level. Basically I want to follow industry recognised, Microsoft approved practices for every aspect of the lifecycle - so planning and architecture, team development, testing procedures, change control and bug-tracking, version control - etc etc. What software to use, which
4
3726
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).
8
2766
by: situ | last post by:
Hello all, i have Database1 and database2, is it possible to make database connection to database2 by running stored procedure on database1. Thanks and Regards Situ
7
10608
by: WTH | last post by:
I am now aware (I am primarily a C++ developer) that in C# if you reference the same interface from the same file in two different projects the types are actually incompatible. I found this out because I have written a generic plugin system for my current and future C# needs. I defined a base plugin system interface named IPlugin (original, I know...) which contains some basic plugin infomration all plugins of this system must expose...
0
9926
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9776
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
10716
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...
1
10812
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10399
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
9552
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
7952
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...
2
4194
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3223
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.