Dieter Maurer wrote:
During our latest discussion to put my most important Zope2 products
into a public repository, I have promissed to publish them on
PyPI instead. Yesterday, I started work to fulfill this promiss
and carefully read the PyPI related documentation -- to find
out, that it is not easy to publish Zope2 products.

As the name suggests, PyPI is for Python packages.
And Zope2 products rightfully are no Python packages:

   When a Zope instance starts, it does potentially
   expensive things for its products.

   I have tiny Zope instances with a few inexpensive products
   that start within a few seconds. And I have huge
   Zope instances with lots of products which parse huge
   XML files or have large message catalogs
   and take half to one minute to start.

   Definitely, I do not want that all my Zope
   instances use the same products installed
   via "setuptools" somewhere under the central "site-packages".

My current ideas towards a solution:

  We define a package prefix for Zope2 products, e.g. "zope2.products".

-1 to more magic namespaces!

  Zope2 products are published to PyPI as "<prefix>.<productname>".

We already have that. Products.*.

Basically, on Zope 2 trunk (and in 2.11), we've made Products/ declare Products.* as a namespace package. That means that you can package up an egg that uses this namespace package and upload it to the cheese shop. Several of the Plone packages, e.g., do this.

  We extend the Zope2 configuration with an option "additional-products"
  which lists the products used by the instance that are not
  at a standard place -- such as those installed by "setuptools"

I really don't see the need for this kind of complication. I would never install a Products.* package into the global python interpreter. That's a recipe for pain and incompatibility. Instead, I'd use zc.buildout or virtualenv to have a sandbox for these eggs.

see and

Secondly, we already have something like additional-products, in that for packages outside the Products.* namespace, we do not automatically read ZCML, call initialize() and so on. Instead, we require that:

- the package's ZCML is explicitly pulled in, either via a ZCML slug, or via an include from another ZCML file which is explicitly (or implicitly, if it's in Products/*) parsed.

- the package uses the <five:registerPackage /> directive to declare the package a Zope 2 product, which causes its initialize() function to be called at the appropriate time.

Note that anything in Products.*, whether eggs in that namespace package or plain directories in e.g. $INSTANCE_HOME/Products, behave as they always have: ZCML is auto-loaded by Five, initialize() is always called.


Acquisition is a jealous mistress

Zope-Dev maillist  -
**  No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to