1. 8
  1. 4

    Does anyone know why XML, JSON, and now TOML are part of the Python standard library but YAML isn’t?

    1. 5

      As I understand it: TOML only goes in because the packaging ecosystem is adopting it as a format for standard files. Otherwise both TOML and YAML would stay third-party.

      And I think that maybe if YAML had become as popular as it is now, but fifteen years ago instead, it would’ve gone in the standard library because that was an era when declaring and enforcing dependencies in Python was difficult. But nowadays the packaging ecosystem makes it pretty easy to just declare a dependency, and the PyYAML module is in good shape in terms of maintainers. And I would expect most things that actually involve YAML parsing involve it as a side effect of something else they want to do, so it would make even less difference to the end user whether YAML is a third-party or stdlib module, since it would just be pulled in as an indirect dependency if needed.

      1. 4

        YAML is still relatively new and not even close in how ubiquitous it is when compared to XML or JSON. As for TOML, Python’s packaging decided to use it for reasons outlined here, and it makes sense to include it in the standard library at that point.

        1. 4

          I think yaml is pretty old (I remember seeing it used in the ruby world at least 15 years ago), but it never got the traction that json and toml did… possibly because it somehow causes even more irritation than json.

          1. 2

            According to Wikipedia, there’s not a significant difference in age between the first three (XML, YAML, and JSON).

            • XML: first published February 10, 1998 (began in 1996)
            • YAML: first releasted May 11, 2001
            • JSON: designed in early 2000s; website went up in 2002; Yahoo begins using JSON in services in 2005
            • TOML: initial release February 23, 2013

            I remember YAML being in common use as a configuration language before JSON caught fire as the dominant language of APIs, but I agree that JSON seems far more prevalent now.

          2. 1

            While I don’t know the specifics around why YAML isn’t part of the standard library, the general view on this is that it’s all about the need for speed :)

            Specifically, the need to be able to crank out new releases & revisions and not be tied to the CPython release cycle. It’s why Requests was never made a part of the standard library.

            My understanding is that YAML is a very complicated spec (JSON is valid YAML, right?) and as such implementing said spec in a secure way is a non trivial task, so releases are frequent. That makes it not a great candidate for the standard library.