Distutils: blurring the file==module borders

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Frans Englich

    #1

    Distutils: blurring the file==module borders


    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.Clas sA()

    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


Working...