I'm writing a suite of data processing scripts with this layout

Data/Vendor/A/proc.py
Data/Vendor/B/proc.py
Etc, etc

Now, I started down the road of having a global config file in
Data/Vendor/Global.ini and a per-vendor local config file in
Data/Vendor/A/Local.ini

But then I realized that I hate any and all mini-languages. I hate embedded
templating languages for dynamic HTML generation (I prefer DOM). And I now
hate mucking about with configuration systems. I prefer language and library
over shortcut mini-languages in this case as well.

Thus, instead of using a merge() operation between the global and local, I
want to have a base class for configuration to replace Global.ini and I want
to extend it in each vendor. To wit:

 class config:
    def ftpserver(): "generalftp.com"
 
In vendor, extending base class

 class config(config):
    def ftpserver(): "specificftp.com"

And in my code, I want to have:

 import config # imported from Data/Vendor/A/config.py
               # which extends Data/Vendor/config.py

 c = config()  # merged config

 ftp = FTP(c.ftpserver()) # "specificftp.com"

So my big problem is how to make each local config available to each local
proc.py. I've thought of some approaches:

* alias python to dataproc and make this a shell script with extends
PYTHONPATH before calling proc.py
* use a setup.py in each directory and install them in site-packages
* Some deep magic line that parses __file__ and adds to PYTHONPATH


Any feedback on how to do this is appreciated.



_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to