[Distutils] comparison of configuration languages

Nick Coghlan ncoghlan at gmail.com
Tue May 10 09:03:31 EDT 2016


On 10 May 2016 at 18:54, Paul Moore <p.f.moore at gmail.com> wrote:
> Well, IMO, the state of things in terms of config file formats (and
> not just in Python) is itself pretty dreadful - every time I write an
> application, I am astounded that there are no good options for
> something as basic as a configuration file format.

This is pretty normal for software - no good options, but a plethora
of "good enough" ones. Hence https://xkcd.com/927/ :)

We just have a particularly exacting use case here, since we want:

- a format that's attractive for folks just learning to program in 2016
- a format that's attractive for folks that have been programming for 50+ years
- a format that's easy to parse even in Python 2.6
- a format that's version control friendly
- a format that's text editor friendly (syntax highlighting, etc)

For me, the two leading contenders out of the current discussion have been:

- the poyo subset of YAML 1.1
- TOML 0.4.0, as implemented by pytoml

The "subset of PyYAML" approach turns this into a documentation
exercise (which subset?), and also runs into the problem that poyo
doesn't handle serialisation yet, only *reading* YAML files.

For TOML, the main questions being asked are around how widely
supported it is, and it's actually in a pretty good state on that
front. 0.4.0 (rather than TOML in general) is stable by definition,
and there are quite a few implementations of that across different
languages: https://github.com/toml-lang/toml/blob/master/versions/en/toml-v0.4.0.md#implementations

The other big thing someone might want is a schema validator, and
there I think it may be possible to just use jsonschema and validate
the result of parsing the file, rather than validating the serialised
form directly.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Distutils-SIG mailing list