[Zope3-dev] pkg_resources or pkgutil?

Philipp von Weitershausen philipp at weitershausen.de
Thu May 25 15:56:02 EDT 2006


Zope3's zope/__init__.py now contains:

  try:
      # Declare this a namespace package if pkg_resources is available.
      import pkg_resources
      pkg_resources.declare_namespace('zope')
  except ImportError:
      pass

where as Zope2's zope/__init__.py contains:

  from pkgutil import extend_path
  __path__ = extend_path(__path__, __name__)

I think they do pretty much the same thing (but I could be mistaken).
Are they interchangeable? If not, are they compatible so that we just
add both ways to both files? If they're not compatible, which one should
we use in the future?

Philipp



More information about the Zope3-dev mailing list