Package Organization (was Re: [Zope3-dev] Voting on Schema design)
Jim Fulton
jim@zope.com
Mon, 15 Jul 2002 14:33:02 -0400
Barry A. Warsaw wrote:
>>>>>>"JF" == Jim Fulton <jim@zope.com> writes:
...
> 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.
Why? The seach order should be governed by sys.path, just as for any
module search.
Would you want a different search order that sys.path?
BTW, I intent for ZopeProducts to work just this way. You'll be able to put
ZopeProducts diorectories in any directory in your search path and subpackages
will be looked up in search-path order. Again, it would be nice if Python
provided a way to automate this pattern.
Jim
--
Jim Fulton mailto:jim@zope.com Python Powered!
CTO (888) 344-4332 http://www.python.org
Zope Corporation http://www.zope.com http://www.zope.org