Skip to content

Introduction

Overview

Other file formats

Several other file formats were put forward for consideration, all rejected for various reasons. Key requirements were that the format be editable by human beings and have an implementation that can be vendored easily by projects. This outright excluded certain formats like XML which are not friendly towards human beings and were never 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 [16].

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).

Ref: https://peps.python.org/pep-0518/