Distutils: blurring the file==module borders

Bill Mill bill.mill at gmail.com
Tue Jan 25 03:17:08 CET 2005


read this thread, it should help you:

http://mail.python.org/pipermail/tutor/2005-January/035124.html

Peace
Bill Mill
bill.mill at gmail.com

On Tue, 25 Jan 2005 02:15:58 +0000, Frans Englich
<frans.englich at telia.com> wrote:
> 
> Hello all,
> 
> Due to the size of my source, I want to split it up into multiple
> files(basically one class in each file), but then I have difficulties with
> the directory layout when the modules are installed with distutils.
> 
> This is my file layout:
> 
> in ./ I have a setup.py which has 'packages="foo"'
> 
> in ./foo/ I have an __init__.py and a handful of files named ClassA.py,
> ClassB.py, ClassC.py and so forth.
> 
> The problem is that when installed, in order to reach, say, classB, I need to
> do:
> 
> import foo.ClassA
> 
> var = foo.ClassA.ClassA()
> 
> while I want to do var = foo.ClassA()
> 
> In other words, the result I want can be achieved by putting all code in
> __init__.py. The problem is that I would find it horrible to have all code in
> one file.
> 
> Python have this one-to-one relationship between modules and files; can what I
> want somehow be achieved?
> 
> Cheers,
> 
>                 Frans
> 
> --
> http://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list