Re: Recommended new way for config files

2010-02-25 Thread Nicola Larosa (tekNico)
Peter wrote: There seems to be several strategies to enhance the old ini-style config files with real python code [...] Is there a strategy that should be prefered for new projects ? 5) Use ConfigObj http://www.voidspace.org.uk/python/configobj.html, by Michael Foord and yours truly. It uses

Re: Recommended new way for config files

2010-01-19 Thread Jonathan Gardner
On Jan 8, 2:54 pm, Ben Finney ben+pyt...@benfinney.id.au wrote: Chris Rebert c...@rebertia.com writes: JSON is one option:http://docs.python.org/library/json.html YAML URL:http://en.wikipedia.org/wiki/YAML is another contender. Compared to JSON, it is yet to gain as much mind-share, but even

Re: Recommended new way for config files

2010-01-08 Thread Jorgen Grahn
On Thu, 2010-01-07, Jean-Michel Pichavant wrote: Peter wrote: Hi There seems to be several strategies to enhance the old ini-style config files with real python code, for example: ... Is there a strategy that should be prefered for new projects ? ... The .ini file is the simpliest

Re: Recommended new way for config files

2010-01-08 Thread r0g
Chris Rebert wrote: On Thu, Jan 7, 2010 at 10:19 AM, Peter vm...@mycircuit.org wrote: snip The .ini file is the simpliest solution, at least from the user point of view, no need to learn any python syntax. I am speaking from the point of view of a python programmer, and I find the .ini

Re: Recommended new way for config files

2010-01-08 Thread Vinay Sajip
On Jan 7, 8:12 pm, Peter vm...@mycircuit.org wrote: snip So what is the worshipped approach, when you need more than name=value pairs ? JSON is one option:http://docs.python.org/library/json.html Thanks, didn't think about that, although most of the apps I know don't seem to use this

Re: Recommended new way for config files

2010-01-08 Thread Peter
On 01/08/2010 03:57 PM, r0g wrote: Chris Rebert wrote: On Thu, Jan 7, 2010 at 10:19 AM, Petervm...@mycircuit.org wrote: snip The .ini file is the simpliest solution, at least from the user point of view, no need to learn any python syntax. I am speaking from the point of

Re: Recommended new way for config files

2010-01-08 Thread Ben Finney
Chris Rebert c...@rebertia.com writes: JSON is one option: http://docs.python.org/library/json.html YAML URL:http://en.wikipedia.org/wiki/YAML is another contender. Compared to JSON, it is yet to gain as much mind-share, but even more human-friendly and no less expressive. Here are some

Recommended new way for config files

2010-01-07 Thread Peter
Hi There seems to be several strategies to enhance the old ini-style config files with real python code, for example: 1) the documentation tool sphinx uses a python file conf.py that is exefile(d) , but execfile is suppressed in Python 3 2) there is a module cfgparse on sourceforge that

Re: Recommended new way for config files

2010-01-07 Thread Jean-Michel Pichavant
Peter wrote: Hi There seems to be several strategies to enhance the old ini-style config files with real python code, for example: 1) the documentation tool sphinx uses a python file conf.py that is exefile(d) , but execfile is suppressed in Python 3 2) there is a module cfgparse on

Re: Recommended new way for config files

2010-01-07 Thread Lie Ryan
On 1/8/2010 3:10 AM, Peter wrote: Is there a strategy that should be prefered for new projects ? The answer is, it depends. -- http://mail.python.org/mailman/listinfo/python-list

Re: Recommended new way for config files

2010-01-07 Thread Robert Kern
On 2010-01-07 10:10 AM, Peter wrote: Hi There seems to be several strategies to enhance the old ini-style config files with real python code, for example: 1) the documentation tool sphinx uses a python file conf.py that is exefile(d) , but execfile is suppressed in Python 3 Only because it is

Re: Recommended new way for config files

2010-01-07 Thread Peter
Thanks for your answer, let me be more precise: I would add the standard module ConfigParser http://docs.python.org/library/configparser.html to your list. of course, that was the implicit starting point of my request, when talking about .ini files. I don't know exactly what you intend to do

Re: Recommended new way for config files

2010-01-07 Thread Chris Rebert
On Thu, Jan 7, 2010 at 10:19 AM, Peter vm...@mycircuit.org wrote: snip The .ini file is the simpliest solution, at least from the user point of view, no need to learn any python syntax. I am speaking from the point of view of a python programmer, and I find the .ini restrictions not

Re: Recommended new way for config files

2010-01-07 Thread Peter
snip So what is the worshipped approach, when you need more than name=value pairs ? JSON is one option: http://docs.python.org/library/json.html Thanks, didn't think about that, although most of the apps I know don't seem to use this approach for improved conf file handling (