PEP 518: Cite @njsmith's config file format review (#668)

* PEP 518: Cite @njsmith's config file format review

* Add a file format feature summary table
This commit is contained in:
Nick Coghlan 2018-06-06 00:04:09 +10:00 committed by GitHub
parent 281927584b
commit dfd9cf15aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 41 additions and 0 deletions

View File

@ -255,6 +255,44 @@ vendored easily by projects. This outright excluded certain formats
like XML which are not friendly towards human beings and were never like XML which are not friendly towards human beings and were never
seriously discussed. seriously discussed.
Overview of file formats considered
'''''''''''''''''''''''''''''''''''
The key reasons for rejecting the other alternatives considered are
summarised in the following sections, while the full review (including
positive arguments in favour of TOML) can be found at [#file_formats]_.
TOML was ultimately selected as it provided all the features we
were interested in, while avoiding the downsides introduced by
the alternatives.
======================= ==== ==== ==== =======
Feature TOML YAML JSON CFG/INI
======================= ==== ==== ==== =======
Well-defined yes yes yes
Real data types yes yes yes
Reliable Unicode yes yes yes
Reliable comments yes yes
Easy for humans to edit yes ?? ??
Easy for tools to edit yes ?? yes ??
In standard library yes yes
Easy for pip to vendor yes n/a n/a
======================= ==== ==== ==== =======
("??" in the table indicates items where most folks would be
inclined to answer "yes", but there turn out to be a lot of
quirks and edge cases that arise in practice due to either
the lack of a clear specification, or else the underlying
file format specification being surprisingly complicated)
The ``pytoml`` TOML parser is ~300 lines of pure Python code,
so being outside the standard library didn't count heavily
against it.
Python literals were also discussed as a potential format, but
weren't considered in the file format review (since they're not
a common pre-existing file format).
JSON JSON
'''' ''''
@ -485,6 +523,9 @@ References
.. [#jsonschema] JSON Schema .. [#jsonschema] JSON Schema
(http://json-schema.org/) (http://json-schema.org/)
.. [#file_formats] Nathaniel J. Smith's file format review
(https://gist.github.com/njsmith/78f68204c5d969f8c8bc645ef77d4a8f)
Copyright Copyright
========= =========