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 8 1914
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
On Feb 22, 11:00 am, "Diez B. Roggisch" <d...@nospam.web.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
>
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
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
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 apluginsystemfor 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
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
On Feb 22, 12:36 pm, "Diez B. Roggisch" <d...@nospam.web.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.
On Feb 22, 12:51 pm, "Flavio" <fccoe...@gmail.comwrote:
On Feb 22, 12:36 pm, "Diez B. Roggisch" <d...@nospam.web.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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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
|
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...
|
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...
|
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...
|
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.
...
|
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...
|
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.
...
|
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...
|
by: Kemmylinns12 |
last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
|
by: Naresh1 |
last post by:
What is WebLogic Admin Training?
WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
|
by: jalbright99669 |
last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
|
by: antdb |
last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine
In the overall architecture, a new "hyper-convergence" concept was...
|
by: Matthew3360 |
last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function.
Here is my code.
...
|
by: Arjunsri |
last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
|
by: WisdomUfot |
last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
|
by: BLUEPANDA |
last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS...
|
by: Rahul1995seven |
last post by:
Introduction:
In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python...
| |