Skip to content

pre-proposal: add extraSchemas to notebook format #96

@agoose77

Description

@agoose77

Background

During the Jupyter Notebook workshop, we established three JEP drafts that would prepare the notebook format for additional cell types, and address the problem of un-typed metadata. On the latter issue, current notebook users have no way to indicate to the notebook consumer that metadata should conform to a particular schema. This prevents the validation of the metadata by third parties, and precludes the ability for frontends to display rich-editing interfaces for this metadata1

Proposal

A separate JEP will move to deprecate the nbformat and nbformat_minor top-level properties, in favour of a direct $schema property. This must contain a URI to an nbformat schema.

This JEP will extend the previous schema to include an extraSchemas property. This optional property may contain an array of URIs that refer to additional schemas. These schemas may not conflict with one another, and all extraSchemas must validate the document alongside the root $schema in order for a notebook to be considered valid. To begin with, any schema in extraSchemas must conform with a restrictive metaschema that permits the addition of properties only to the notebook and cell metadata. In future, this may be relaxed.

Examples

Example of valid notebook under this proposal:

{
    "$schema": "https://jupyter.org/schema/notebook/4.6/notebook-4.6.schema.json"
    "extraSchemas": [
        "my-extension-schema-uri"
    ],
    "metadata": { 
        "my-extension": {
        }    
    }
    "cells": []
}

Example of schema referenced in extraSchemas ("my-extension-schema-uri"):

{
    "$schema": "https://jupyter.org/schema/notebook/4.6/notebook-4.6.schema.json"
    "metadata": { 
        "type": "object",
        "required": ["my-extension"]
    }
}

Further Information

As this is a complex area of discussion (multi-stakeholder, significant long-term impact, niche tooling), we are holding regular, open discussions under the general topic of "extra cell types". The meeting notes from the first of such meetings can be found here. Those wishing to attend can find more information there.

Footnotes

  1. e.g. with tools like react-jsonschema-form

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions