fortepianissimo wrote: > Say I have the following package organization in a system I'm > developing: > > A > |----B > |----C > |----D > > I have a module, say 'foo', that both package D and B require. What is > the best practice in terms of creating a 'common' package that hosts > 'foo'? I want to be able to > > - Testing modules in D right in D's directory and testing modules in B > in B's directory; > - If possible, minimize the modification to PYTHONPATH or sys.path > while doing the above.
What I do is run always from the base directory (violates your first requirement). I make a util package to hold commonly used code. Then B and D both use from util import foo In Python 2.5 you will be able to say (in D, for example) from ..util import foo http://www.python.org/peps/pep-0328.html Kent -- http://mail.python.org/mailman/listinfo/python-list