YAML config file parser

Peter Maas fpetermaas at netscape.net
Fri Feb 13 06:53:23 EST 2004


A.M. Kuchling wrote:
>>structures into the configuration. From the sysadmin's perspective this
>>is not so satisfactory: he would prefer a common configuration format
>>for his system. 
> 
> I don't believe that assertion. 

Belief is not debatable :)

 > We have whitespace-delimited files (cron,
> /etc/hosts), colon-delimited files (passwd, groups), files containing
> line-oriented commands (resolv.conf), ones grouped into subsections and ones
> that are flat, etc. and everyone manages to survive.

Easyness and fun is more than surviving. The files you mention
are linux system files. To create a unified config format for
linux/unix is a task that Python can't handle. I speak only of
application configurations.

> YAML also has the disadvantage of being a complicated format to learn 

YAML isn't as verbose as XML, good for editor users. Config files
should need only a YAML subset: strings, numbers, dates, lists,
dictionaries. This seems to be fairly easy.

 > it borrows features from Unix-style config files,
 > Python, XML, and RFC 2822, but it doesn't look like any of them

Which UNIX style? Anyway, it shouldn't look like Python because
Perl programmers and non-programmers should also be happy with it.

> A good feature of using Python for some applications is that you can then
> provide alternatives such as:
> 
> if socket.gethostname() == 'devel':
>     MAIL_EXCEPTIONS = False
>     LOG_LEVEL = 'debug'
> else:
>     MAIL_EXCEPTIONS = False
>     LOG_LEVEL = 'warn'
>     
> This is messier in a declarative format.

A configuration file should contain a set of mutually independent
variables describing the state of the installed application. This
is not messy. I see mixing of state and logic as a conceptual
disadvantage. It makes life easy for the programmer but not for
the users who sometimes happen to be non-programmers.

Knowing the source is mostly fine but *having* to know the source all
the time is not so fine. Not every language is as friendly as Python.

Mit freundlichen Gruessen,

Peter Maas

-- 
-------------------------------------------------------------------
Peter Maas, M+R Infosysteme, D-52070 Aachen, Hubert-Wienen-Str. 24
Tel +49-241-93878-0 Fax +49-241-93878-20 eMail peter.maas at mplusr.de
-------------------------------------------------------------------



More information about the Python-list mailing list