By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,676 Members | 2,249 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,676 IT Pros & Developers. It's quick & easy.

Distutils: blurring the file==module borders

P: n/a

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
Jul 18 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.