Python: Decent config file format

Posted by miracle2k on Stack Overflow See other posts from Stack Overflow or by miracle2k
Published on 2010-06-09T16:27:13Z Indexed on 2010/06/09 17:02 UTC
Read the original article Hit count: 379

I'd like to use a configuration file format which supports key value pairs and nestable, repeatable structures, and which is as light on syntax as possible. I'm imagining something along the lines of:

cachedir = /var/cache
mail_to = [email protected]

job {
   name = my-media
   frequency = 1 day
   source {
      from = /home/michael/Images

   source { }
   source { }       
}

job { }

I'd be happy with something using significant-whitespace as well.

JSON requires too many explicit syntax rules (quoting, commas, etc.). YAML is actually pretty good, but would require the jobs to be defined as a YAML list, which I find slightly awkward to use.

© Stack Overflow or respective owner

Related posts about python

Related posts about configuration