[Zope-dev] Re: How to publish Zope2 products on PyPI

Philipp von Weitershausen philipp at weitershausen.de
Sat Sep 22 13:27:04 EDT 2007

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:

Sure they are. They're a directory with an __init__.py.

I think this is a misunderstanding. It seems you think Python packages 
have to be installed globally. This isn't the case. And certainly nobody 
would recommend doing that for Products packages.

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

This would only be a problem if the Products packages were installed 
globally. They don't have to. See below.

>    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".

Nobody expects you to. As others have pointed out

* PyPI doesn't necessarily have to contain eggs. It's primarily a 
discovery mechanism for humans. The fact that setuptools can download 
packages from it is not as important as the fact that developers can 
find packages there.

* Installing eggs doesn't necessarily mean they're installed globally 
into site-packages. There are a number of mechanism to create isolated 
sandboxes, some of which include turning a Zope 2 instance into an 
egg-capable sandbox (in other words, so that lib/python can contain 
eggs). And then there's zc.buildout, of course.

> My current ideas towards a solution:
>   We define a package prefix for Zope2 products, e.g. "zope2.products".
>   Zope2 products are published to PyPI as "<prefix>.<productname>".


+1 for *continuing* to use the already widely used Products prefix.

>   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"

As long as the packages are on the PYTHONPATH, Zope 2 will find them. I 
don't think there's a need for this new directive.

http://worldcookery.com -- Professional Zope documentation and training

More information about the Zope-Dev mailing list