Python program organization
François Pinard
pinard at iro.umontreal.ca
Mon Feb 23 08:53:43 EST 2004
> > > [Derek W]
> > >>Is it proper to break the program up into modules and put all of
> > >>the modules in a package even if the modules would be of little or
> > >>no use to others (such as the program specific GUI code)? Would
> > >>this package then go under Python's site-packages directory when
> > >>the program is installed?
> > [François Pinard]
> > > This is the most natural thing to do.
[Fuzzyman]
> I disagree - if your program is an application it would be more normal
> to put it in it's own directory in 'Program Files' [...]
Oh! I'm not an MS user, but would presume `Program Files' is a bit like
`/usr/local/bin/' on Unix, or maybe the preferred place from where icons
on the desktop launch execution?
For a Python software system, best might be to install the bulk of it
into a package, or a hierarchy of packages, within `.../site-packages/'.
But of course, one always need a very small bootstrap along the search
PATH for executables whose sole purpose is importing the `main' module
from the installed packaged and launching it. This bootstrap is the
only fragment of the whole Python software system which is not compiled.
> It's much better to save that directory for 'general' modules that are
> going to be reused.
Each Python system in its own hierarchy within `.../site-packages/', but
all small bootstraps are kept together within a single directory.
For generic modules which do not pertain specifically to a Python
system, we created a special package named `Local'. This is useful in
our shop. Any Python system may import from Local, of course.
--
François Pinard http://www.iro.umontreal.ca/~pinard
More information about the Python-list
mailing list