Package Organization (was Re: [Zope3-dev] Voting on Schema design)

Barry A. Warsaw barry@zope.com
Mon, 15 Jul 2002 13:49:18 -0400


>>>>> "JF" == Jim Fulton <jim@zope.com> writes:

    JF> I don't follow you at all. Any time you want to import
    JF> Zope.PackageA, you just:

    JF>    import Zope.PackageA

    JF> I don't see what Zope.PackageB has to do with it.

My mythical application (or Zope Product) has the following:

    from Zope.PackageA.ModuleA import ClassA
    from Zope.PackageB.ModuleB import ClassB

with a directory layout like this:

    .../patha/Zope/PackageA/ModuleA.py
    .../pathb/Zope/PackageB/ModuleB.py

Say ".../patha" is "<zopehome>/lib/python"
and ".../pathb" is "<pythoninstall>/Lib/site-packages"

My application wants these packages from different locations because,
while the version of PackageA that comes with Zope 3.x is fine for my
purposes, I need the newer (independent) version of PackageB, which
I've installed in my site-packages.

    JF> Well, if you want to sprad a package over multiple physical
    JF> locations, that's easy enough to do. We do that in Zope 2
    JF> now. Perhaps Python could provide a mechanism to make this
    JF> easier. For example, it might be nice if packages could
    JF> contain meta-data that would tell Python to search for
    JF> multiple package directories along the Python path,

The one thing you don't want is for this mechanism to be dependent on
search order, because it might be very difficult to get Python to
search .../patha/Zope before .../pathb/Zope.

Hmm, I wonder if the .pth stuff could handle this?
-Barry