[Distutils] comparison of configuration languages

Wolfgang tds333 at mailbox.org
Tue May 10 08:40:33 EDT 2016


Hi,

have done a lot of configuration stuff. Also used the Python ConfigParser
(backported version from 3.x)
It can be improved, yes. ;-)

But the INI style syntax is known and there are tools and parsers available.
It is a simple format and this is good. Because it is still human readable
and simple configurations can be done with it. Configurations should be simple!

But if there are complex requirements the ConfigParser can be extended.
(done this for custom interpolation and config includes)
Also the allowed comment characters can customized and limited to '#'.

So why not use the ConfigParser available with Python and extend it to meet
the requirements. Custom getters can be written and for the complex
stuff ast.literal_eval() can be used to safely parse the complex list
of requirements with comments.
Like register new converter:

converters = {"literal": ast.literal_eval}

used then with:

config.getliteral("bootstrap", "requirements")

Config example:

[bootstrap]
reqirements = [ "setuptools >= 27",
	        "numpy >= 1.10",
                "the-versionator == 0.13",
              ]


My opinion is, keep the configuration and used syntax for this simple.
YAML is not simple even the spec is complex.
TOML is not mature enough and even not known enough.

INI style is already used for setup.cfg. Use it in other places too.
Extend it where the need is to extend it and document this.
If extended with Python syntax, everyone should be familiar with it.
The tools are used for/with Python.


Regards,

Wolfgang



More information about the Distutils-SIG mailing list