What's the official way of storing settings for Python programs? What's the official way of storing settings for Python programs? python python

What's the official way of storing settings for Python programs?


Depends on the predominant intended audience.

If it is programmers who change the file anyway, just use python files like settings.py

If it is end users then, think about ini files.


As many have said, there is no "offical" way. There are, however, many choices. There was a talk at PyCon this year about many of the available options.


Don't know if this can be considered "official", but it is in standard library: 14.2. ConfigParser — Configuration file parser.

This is, obviously, not an universal solution, though. Just use whatever feels most appropriate to the task, without any necessary complexity (and — especially — Turing-completeness! Think about automatic or GUI configurators).