In all this talk about using a YAML subset, I'm surprised no one mentioned YAMLish:
https://pypi.python.org/pypi/yamlish
It is a well defined subset of YAML and there are implementations in other programming languages.
The problem with the 200+-lines-single-file library above is that it depends on PyYAML itself so, vendoring it will be challenging.
Anyway, I think TOML 0.4.0 is good enough for our needs.
On 10 May 2016 at 18:54, Paul Moore <p.f.moore@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@gmail.com | Brisbane, Australia
_______________________________________________
Distutils-SIG maillist - Distutils-SIG@python.org
https://mail.python.org/mailman/listinfo/distutils-sig