Import question

Andrew Degtiariov andrew.degtiariov at gmail.com
Mon Feb 8 16:39:42 EST 2010


Those are called namespace packages. Zope and Plone (ab)use them

> extensively. The intended usage is to break up a big, monolithic package
> [0] in parts that can be distributed independently. To implement a
> namespace package, you need an empty __init__.py file with only these
> lines [1]:
>
>  from pkgutil import extend_path
> __path__ = extend_path(__path__, __name__)
>
> But think carefully if you really need namespace packages; they solve a
> specific problem, aren't a general purpose technique. See [2] for a
> discussion.
>
> [0] Think of a huge behemoth with a "Z O P E" sign on both sides :)
> [1] http://docs.python.org/library/pkgutil.html
> [2] http://weblion.psu.edu/news/are-we-overusing-namespace-packages
>
>
Hm.. We are using pkg_resources.declare_namespace(__name__) but I think
pkgutil is much better.
And we are using buildout so the omelette might help me. Link [2] very
interesting.
Thank you, Gabrial.

-- 
Andrew Degtiariov
DA-RIPE
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100208/18807f12/attachment-0001.html>


More information about the Python-list mailing list