Skip to content

Commit

Permalink
Kernelspec JSON schema
Browse files Browse the repository at this point in the history
  • Loading branch information
JohanMabille committed Apr 19, 2023
1 parent 15e8169 commit 86ef612
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 0 deletions.
29 changes: 29 additions & 0 deletions kernelspec-spec/kernelspec-spec.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
title: kernelspec specification
authors: Johan Mabille
issue-number: XX
pr-number: XX
date-started: "2023-04-19"
---

# Specification of the kernelspec

## Problem

The kernelspec configuration file is documented aside the kernel protocol documentation, but it is not
*specified*. Besides, it might be unclear whether the kernelspec is part of the kernel protocol, or
independent.

## Proposed Enhancement

We propose to specify the kernelspec with the JSON schema joined in this PR. The specification is conform
to [the current description of the kernelspec](https://jupyter-client.readthedocs.io/en/stable/kernels.html#kernel-specs),
and adds an optional `protocol_version` field.

[A dedicated repo](https://github.com/jupyter-standards/kernelspec) for the specification and the documentation of
the kernelspec has been created.

### Impact on existing implementations

None, this JEP only adds an optional field in the kernelspec.

44 changes: 44 additions & 0 deletions kernelspec-spec/kernelspec.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://standards.jupyter.org/kernelspec.schema.json",
"title": "Kernelspec",
"description": "Specification of the kernelspec file",
"type": "object",
"properties": {
"argv": {
"description": "A list of command line arguments used to start the kernel. The text {connection_file} in any argument will be replaced with the path to the connection file.",
"type": "array",
"items": {
"type": "string"
},
"minItems": 3
},
"display_name": {
"description": "The kernel’s name as it should be displayed in the UI. Unlike the kernel name used in the API, this can contain arbitrary unicode characters.",
"type": "string"
},
"language": {
"description": "The name of the language of the kernel. When loading notebooks, if no matching kernelspec key (may differ across machines) is found, a kernel with a matching language will be used. This allows a notebook written on any Python or Julia kernel to be properly associated with the user’s Python or Julia kernel, even if they aren’t listed under the same name as the author’s.",
"type": "string"
},
"protocol_version": {
"description": "The version of protocol this kernel implements. If not specified, the client will assume the version is <5.5 until it can get it via the kernel_info request.",
"type": "string"
},
"interrupt_mode": {
"description": "May be either signal or message and specifies how a client is supposed to interrupt cell execution on this kernel, either by sending an interrupt signal via the operating system’s signalling facilities (e.g. SIGINT on POSIX systems), or by sending an interrupt_request message on the control channel (see Kernel interrupt). If this is not specified the client will default to signal mode.",
"type": "string",
"enume": ["signal", "message"]
},
"env": {
"description": "A dictionary of environment variables to set for the kernel. These will be added to the current environment variables before the kernel is started. Existing environment variables can be referenced using ${<ENV_VAR>} and will be substituted with the corresponding value. Administrators should note that use of ${<ENV_VAR>} can expose sensitive variables and should use only in controlled circumstances.",
"type": "object",
"additionalProperties": {"type": "string" }
},
"metadata": {
"description": "A dictionary of additional attributes about this kernel; used by clients to aid in kernel selection. Metadata added here should be namespaced for the tool reading and writing that metadata.",
"type": "object"
}
},
"required": ["argv", "display_name", "language"]
}

0 comments on commit 86ef612

Please sign in to comment.