[Python-Dev] PEP 376 proposed changes for basic plugins support

Michael Foord fuzzyman at voidspace.org.uk
Mon Aug 2 15:17:48 CEST 2010


On 02/08/2010 13:31, exarkun at twistedmatrix.com wrote:
> On 12:21 pm, mal at egenix.com wrote:
>> Tarek Ziad� wrote:
>>> On Mon, Aug 2, 2010 at 3:06 AM, P.J. Eby <pje at telecommunity.com> wrote:
>>> ..
>>>>
>>>> So without specific examples of why this is a problem, it's hard to 
>>>> see why
>>>> a special Python-specific set of configuration files is needed to 
>>>> resolve
>>>> it, vs. say, encouraging application authors to use the available
>>>> alternatives for doing plugin directories, config files, etc.
>>>
>>> I don't have a specific example in mind, and I must admit that if an
>>> application does the right thing
>>> (provide the right configuration file), this activate feature is not
>>> useful at all. So it seems to be a bad idea.
>>>
>>> I propose that we drop the PLUGINS file idea and we add a new metadata
>>> field called Provides-Plugin
>>> in PEP 345, which will contain the info I've described minus the state
>>> field. This will allow us to expose
>>> plugins at PyPI.
>>>
>>> IOW, have entry points like setuptools provides, but in a metadata
>>> field instead of a entry_points.txt file.
>>
>> Do we really need to make Python packaging even more complicated by
>> adding support for application-specific plugin mechanisms ?
>>
>> Packages can already work as application plugins by simply defining
>> a plugins namespace package and then placing the plugin packages
>> into that namespace.
>>
>> See Zope for an example of how well this simply mechanism works out in
>> practice: it simply scans the "Products" namespace for sub-packages and
>> then loads each sub-package it finds to have it register itself with 
>> Zope.
>
> This is also roughly how Twisted's plugin system works.  One drawback, 
> though, is that it means potentially executing a large amount of 
> Python in order to load plugins.  This can build up to a significant 
> performance issue as more and more plugins are installed.
>

unittest will solve this problem by having plugins explicitly enabled in 
its own configuration system, and possibly managed through a separate 
tool like a plugins subcommand. The full package list will *only* need 
to be scanned when managing plugins, not during normal execution.

Having this distutils2 supported "plugin declaration and discovery" will 
be extremely useful for the unittest plugin system. Given that plugins 
may need configuring after installation, and tools that handle both 
activation and configuration can be provided, it doesn't seem a heavy cost.

The downside to this is that installing and activating plugins are two 
separate steps. Given that each project can have a different set of 
plugins enabled I don't see a way round it.

Michael

> Jean-Paul
>
>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/fuzzyman%40voidspace.org.uk
>    


-- 
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog

READ CAREFULLY. By accepting and reading this email you agree, on behalf of your employer, to release me from all obligations and waivers arising from any and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and acceptable use policies (”BOGUS AGREEMENTS”) that I have entered into with your employer, its partners, licensors, agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. You further represent that you have the authority to release me from any BOGUS AGREEMENTS on behalf of your employer.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20100802/a5e244fd/attachment.html>


More information about the Python-Dev mailing list