A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2010-August/102704.html below:

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

[Python-Dev] PEP 376 proposed changes for basic plugins supportP.J. Eby pje at telecommunity.com
Mon Aug 2 23:02:11 CEST 2010
At 05:08 PM 8/2/2010 +0200, Éric Araujo wrote:
>I wonder if functions in pkgutil or importlib could allow one to 
>iterate over the plugins (i.e. submodules and subpackages of the 
>namespace package) without actually loading then.

See pkgutil.walk_packages(), available since 2.5.

It has to load __init__.py files, especially because of namespace 
packages, but it doesn't load any non-package modules.

That being said, using namespace packages for plugins kind of defeats 
the true purpose of namespace packages, which is to give developers 
private package namespaces they can use across multiple projects, 
like zope.*, peak.*, twisted.*, etc., thereby avoiding naming 
conflicts in the root package namespace.

Granted, you can always re-nest namespaces and do something like 
someproject.plugins.mynamehere.myplugin, but with entry points you 
can just register something in mynamehere.mysomeprojectplugin, and 
flat is better than nested.  ;-)  (Plus, you can include information 
about the individual plugins/features residing in that module in the 
metadata, and avoid importing until/unless you need that feature.)

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4