Package organization

Robert Ferrell ferrell at diablotech.com
Tue Nov 18 19:38:15 EST 2003


I have a question about how to organize modules in a package.  I think
there is something fundamental that I am missing.  Say I'm creating a
package,
GreatPackage, which has three sub-packages, myUtilities, GoodStuff,
MoreGoodStuff.

The directories look like:

GreatPackage
     |
     |-- myUtilities
     |
     |-- GoodStuff
     |
     |-- MoreGoodStuff

What is the right way for modules in GoodStuff and MoreGoodStuff to
refer to modules etc... in myUtilities?  I'd like to set PYTHONPATH to
just point to the directory containing GreatPackage.  But, if put
something like:

from GreatPackage.myUtilities import aUtilityThingy

in a module in GoodStuff, then the whole package gets loaded,
including MoreGoodStuff.  That's okay except when I'm developing and
MoreGoodStuff is broken.

What are guidelines for developing/deploying packages which contain
pacakges?

thanks,
-robert




More information about the Python-list mailing list