Distutils: blurring the file==module borders

F

Frans Englich

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top