nbformat v4

Still quite a bit to do, but the implemented parts of v4 are working pretty well. I did find and fix some things while testing the validation. Both v3 and v4 have a Draft 4 jsonschema, and use the standard jsonschema format for references, so jsonpointer is no longer used.

closes #5074 

TODO in separate PRs:

- backport v4->v3 to 2.x
- what to do when uploading old notebooks (upgrade on upload, or leave alone and upgrade on open)?


- [x] add convert 3<->4
- [x] make v4 current
- [x] update stream messages to `name, text`
- [x] move display_data.png to display_data.data['image/png']
- [x] what's new
- [x] decide on UI for downgrade
- [x] upgrade existing example notebooks
We discussed this on the dev meeting, and decided against having a default
value, because it would be too easy to write code assuming the v4 api, say,
which would then break when the default changes to v5. It's better to make
the developer explicitly choose, so their code gets a predictable notebook
structure.

If we could assume python 3, I would make this a keyword only argument.
Since we can't, I don't think it's worth the shenanigans to prevent people
passing it positionally.
On 25 Oct 2014 11:13, "Matthias Bussonnier" <notifications@github.com>
wrote:

> In IPython/nbformat/__init__.py:
>
> > +    -------
> > +    s : unicode
> > +        The notebook as a JSON string.
> > +    """
> > +    if version is not NO_CONVERT:
> > +        nb = convert(nb, version)
> > +    else:
> > +        version, _ = reader.get_version(nb)
> > +    try:
> > +        validate(nb)
> > +    except ValidationError as e:
> > +        get_logger().error("Notebook JSON is invalid: %s", e)
> > +    return versions[version].writes_json(nb, **kwargs)
> > +
> > +
> > +def read(fp, as_version, **kwargs):
>
> woudl put as_version as a kwarg too, with a defautl value to most recent.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/ipython/ipython/pull/6045/files#r19376867>.
>