[Python-Dev] pkgutil, pkg_resource and Python 3.0 name space packages

Phillip J. Eby pje at telecommunity.com
Sun Jan 6 20:32:50 CET 2008


At 04:33 PM 1/6/2008 +0100, Christian Heimes wrote:
>Hello!
>
>We are discussing name space packages on the stdlib reorg list. For
>Python 3.0 we plan to organize the packages by purpose, e.g. put all
>database related packages like sqlite and shelve in a 'databases' name
>space.
>
>Of course we want to have the name spaces extensible by 3rd party
>software. The Python world as currently two ways to create extensible
>name space packages: pkgutil and pkg_resource.
>
>pkgutil is part of Python 2.5. pkg_resource is scheduled for Python 2.6
>and 3.0 in PEP 365 [1]. The PEP hasn't been accepted yet.
>
>Questions:
>
>* PJE: Is pkg_resource ready for Python 2.6 and 3.0?

The extra feature proposed in PEP 365 isn't done yet.  Without the 
PEP acceptance, I didn't feel the need to rush on finishing 
it.  Apart from that, the pkg_resources module has been pretty darn stable.


>* GvR: Are you going to accept Phillip's PEP?
>
>* PJE: Does pkg_resource have an easy way to overwrite a package in a
>name space package?

OverRIDE, yes; overWRITE, no.


>E.g. an user wants to overwrite Python's
>databases.sqlite with a newer version of sqlite. Can he simply do it by
>inserting a package into sys.path before Lib/ ?

As long as the 'databases' package hasn't been imported or had its 
namespace declared yet, yes.

(I'm making the assumption, of course, that all of the namespace 
package requirements have been met: i.e., each package has a 
database/__init__.py that contains a namespace declaration and nothing else.)



More information about the Python-Dev mailing list