[Python-ideas] PEP 426, YAML in the stdlib and implementation discovery

Antoine Pitrou solipsis at pitrou.net
Fri May 31 23:05:21 CEST 2013


On Fri, 31 May 2013 16:11:10 -0400
Brett Cannon <brett at python.org> wrote:
> On Fri, May 31, 2013 at 2:43 PM, Guido van Rossum <guido at python.org> wrote:
> > On Fri, May 31, 2013 at 11:35 AM, Brett Cannon <brett at python.org> wrote:
> >> So yaml is not going to end up in the stdlib. The format is not used
> >> widely enough to warrant being added nor have to maintain a parser for
> >> such a complicated format.
> >
> > Hm. What makes you think it's not being used widely enough?
> 
> In my purview it isn't. I mean I know App Engine uses it but I just
> don't come across it often enough to think that we should incorporate
> it.

YAML is used by both Salt and Ansible, two configuration management
engines (*) written in Python with growing popularity.
http://docs.saltstack.com/topics/tutorials/starting_states.html#default-data-yaml
http://ansible.cc/docs/playbooks.html#playbook-language-example

(*) in other words, Chef / Puppet contenders
https://www.ohloh.net/p/compare?project_0=Chef&project_1=salt&project_2=Ansible

> > I suppose
> > JSON is more popular, but it's not like YAML is dying. AFAIK there's a
> > 3rd party yaml parser that we could incorporate with its authors'
> > permission -- this would save people from a pretty common dependency
> > (just like we did for JSON).
> 
> Sure, but the pure Python version is naively 5,500 lines, just 500
> lines less than decimal.py. The json package is 1,100. Sure it's
> difficult to get right since the format is hard to parse which is an
> argument for it's addition, but this would not be a small import of
> code.

I agree that YAML being on the complex side is a bit of a warning sign
for stdlib inclusion.

> I'm talking purely from the perspective of writing it by hand which is
> what sparked this conversation. There is no new format to really learn
> like with YAML: write a Python dict using double-quotes for strings
> and lowercase your singletons from Python and you basically there.

But writing JSON by hand isn't really pleasant or convenient. It's ok
for small lumps of data. Salt and Ansible don't (seem to) use YAML for
anything complicated, just the much friendlier user experience.

Regards

Antoine.




More information about the Python-ideas mailing list