How to organize Python files in a (relatively) big project

Jarek Zgoda jzgoda at o2.usun.pl
Wed Oct 19 15:17:57 EDT 2005


Giovanni Bajo napisał(a):

> Remember that the directory where you start the toplevel script is always
> included in the sys.path. This means that you can have your structure like
> this:
> 
> main.py
>    |
>    | - - pkg1
>    | - - pkg2
>    | - - pkg3
> 
> Files in any package can import other packages. The usual way is to do "import
> pkgN" and then dereference. Within each package, you will have a __init__.py
> which will define the package API (that is, will define those symbols that you
> can access from outside the package).

How to install this structure eg. on Linux? What layout do you
recommend? It's tempting to use /opt hierarchy for installation target
(as it gives relatively much freedom within application directory), but
many administrators are reluctant to use this hierarchy and prefer more
standarized targets, such as /usr or /usr/local.

-- 
Jarek Zgoda
http://jpa.berlios.de/



More information about the Python-list mailing list