-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some tooling experiments #4
Open
ianthomas23
wants to merge
5
commits into
jupyter:main
Choose a base branch
from
ianthomas23:tooling_expts
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
7135ffa
Follow naming convention of issue 2
ianthomas23 627dd2e
Validate schemas against meta schema (2020-12 Draft)
ianthomas23 445e548
Add kernel spec schema
ianthomas23 a9805b6
Add a couple of kernel message schemas
ianthomas23 36656ec
Doc build
ianthomas23 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Minimal makefile for Sphinx documentation | ||
# | ||
|
||
# You can set these variables from the command line, and also | ||
# from the environment for the first two. | ||
SPHINXOPTS ?= | ||
SPHINXBUILD ?= sphinx-build | ||
SOURCEDIR = . | ||
BUILDDIR = _build | ||
|
||
# Put it first so that "make" without argument is like "make help". | ||
help: | ||
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) | ||
|
||
.PHONY: help Makefile | ||
|
||
# Catch-all target: route all unknown targets to Sphinx using the new | ||
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). | ||
%: Makefile | ||
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Configuration file for the Sphinx documentation builder. | ||
# | ||
# For the full list of built-in configuration values, see the documentation: | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html | ||
|
||
# -- Project information ----------------------------------------------------- | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information | ||
|
||
project = 'jupyter-schemas' | ||
copyright = '2024, .' | ||
author = 'Jupyter Development Team' | ||
|
||
# -- General configuration --------------------------------------------------- | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration | ||
|
||
extensions = [ | ||
'sphinx.ext.autodoc', | ||
'sphinx_design', | ||
'sphinx-jsonschema' | ||
] | ||
|
||
templates_path = ['_templates'] | ||
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] | ||
|
||
|
||
|
||
# -- Options for HTML output ------------------------------------------------- | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output | ||
|
||
html_theme = 'pydata_sphinx_theme' | ||
html_static_path = ['_static'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
Example schema | ||
============== | ||
|
||
.. tab-set:: | ||
|
||
.. tab-item:: Rendered using sphinx-jsonschema | ||
|
||
.. jsonschema:: ../schema/server/events/kernel-actions/v1/kernel-actions.schema.json | ||
|
||
.. tab-item:: JSON | ||
|
||
.. literalinclude:: ../schema/server/events/kernel-actions/v1/kernel-actions.schema.json | ||
:language: JSON | ||
|
||
.. tab-item:: TOML | ||
|
||
.. code-block:: toml | ||
|
||
"$schema" = "https://json-schema.org/draft/2020-12/schema" | ||
"$id" = "https://schema.jupyter.org/server/events/kernel-actions/v1/kernel-actions.schema.json" | ||
version = 1 | ||
title = "Kernel Manager activities" | ||
personal-data = true | ||
description = "Record events of a kernel manager.\n" | ||
type = "object" | ||
required = [ "action", "msg",] | ||
|
||
[properties.action] | ||
enum = [ "start", "interrupt", "shutdown", "restart",] | ||
description = "Action performed by the Kernel Manager.\n\nThis is a required field.\n\nPossible values:\n\n1. start\n A kernel has been started with the given kernel id.\n\n2. interrupt\n A kernel has been interrupted for the given kernel id.\n\n3. shutdown\n A kernel has been shut down for the given kernel id.\n\n4. restart\n A kernel has been restarted for the given kernel id.\n" | ||
|
||
[properties.kernel_id] | ||
type = "string" | ||
description = "Kernel id.\n\nThis is a required field for all actions and statuses except action start with status error.\n" | ||
|
||
[properties.kernel_name] | ||
type = "string" | ||
description = "Name of the kernel.\n" | ||
|
||
[properties.status] | ||
enum = [ "error", "success",] | ||
description = "Status received from a rest api operation to kernel server.\n\nThis is a required field.\n\nPossible values:\n\n1. error\n Error response from a rest api operation to kernel server.\n\n2. success\n Success response from a rest api operation to kernel server.\n" | ||
|
||
[properties.status_code] | ||
type = "number" | ||
description = "Http response codes from a rest api operation to kernel server.\nExamples: 200, 400, 502, 503, 599 etc\n" | ||
|
||
[properties.msg] | ||
type = "string" | ||
description = "Description of the event specified in action.\n" | ||
|
||
[if.not.properties.status] | ||
const = "error" | ||
|
||
[if.not.properties.action] | ||
const = "start" | ||
|
||
[then] | ||
required = [ "kernel_id",] | ||
|
||
.. tab-item:: YAML | ||
|
||
.. code-block:: yaml | ||
|
||
$schema: https://json-schema.org/draft/2020-12/schema | ||
$id: https://schema.jupyter.org/server/events/kernel-actions/v1/kernel-actions.schema.json | ||
version: 1 | ||
title: Kernel Manager activities | ||
personal-data: true | ||
description: 'Record events of a kernel manager. | ||
|
||
' | ||
type: object | ||
required: | ||
- action | ||
- msg | ||
properties: | ||
action: | ||
enum: | ||
- start | ||
- interrupt | ||
- shutdown | ||
- restart | ||
description: "Action performed by the Kernel Manager.\n\nThis is a required field.\n\nPossible values:\n\ | ||
\n1. start\n A kernel has been started with the given kernel id.\n\n2. interrupt\n A kernel\ | ||
\ has been interrupted for the given kernel id.\n\n3. shutdown\n A kernel has been shut down for\ | ||
\ the given kernel id.\n\n4. restart\n A kernel has been restarted for the given kernel id.\n" | ||
kernel_id: | ||
type: string | ||
description: 'Kernel id. | ||
|
||
|
||
This is a required field for all actions and statuses except action start with status error. | ||
|
||
' | ||
kernel_name: | ||
type: string | ||
description: 'Name of the kernel. | ||
|
||
' | ||
status: | ||
enum: | ||
- error | ||
- success | ||
description: "Status received from a rest api operation to kernel server.\n\nThis is a required field.\n\ | ||
\nPossible values:\n\n1. error\n Error response from a rest api operation to kernel server.\n\n\ | ||
2. success\n Success response from a rest api operation to kernel server.\n" | ||
status_code: | ||
type: number | ||
description: 'Http response codes from a rest api operation to kernel server. | ||
|
||
Examples: 200, 400, 502, 503, 599 etc | ||
|
||
' | ||
msg: | ||
type: string | ||
description: 'Description of the event specified in action. | ||
|
||
' | ||
if: | ||
not: | ||
properties: | ||
status: | ||
const: error | ||
action: | ||
const: start | ||
then: | ||
required: | ||
- kernel_id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
.. jupyter-schemas documentation master file, created by | ||
sphinx-quickstart on Fri Feb 23 14:44:15 2024. | ||
You can adapt this file completely to your liking, but it should at least | ||
contain the root `toctree` directive. | ||
|
||
Welcome to jupyter-schemas's documentation! | ||
=========================================== | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
:caption: Contents: | ||
|
||
example | ||
|
||
|
||
Indices and tables | ||
================== | ||
|
||
* :ref:`genindex` | ||
* :ref:`modindex` | ||
* :ref:`search` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
@ECHO OFF | ||
|
||
pushd %~dp0 | ||
|
||
REM Command file for Sphinx documentation | ||
|
||
if "%SPHINXBUILD%" == "" ( | ||
set SPHINXBUILD=sphinx-build | ||
) | ||
set SOURCEDIR=. | ||
set BUILDDIR=_build | ||
|
||
%SPHINXBUILD% >NUL 2>NUL | ||
if errorlevel 9009 ( | ||
echo. | ||
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx | ||
echo.installed, then set the SPHINXBUILD environment variable to point | ||
echo.to the full path of the 'sphinx-build' executable. Alternatively you | ||
echo.may add the Sphinx directory to PATH. | ||
echo. | ||
echo.If you don't have Sphinx installed, grab it from | ||
echo.https://www.sphinx-doc.org/ | ||
exit /b 1 | ||
) | ||
|
||
if "%1" == "" goto help | ||
|
||
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% | ||
goto end | ||
|
||
:help | ||
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% | ||
|
||
:end | ||
popd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"$schema": "https://json-schema.org/draft/2020-12/schema", | ||
"$id": "https://schema.jupyter.org/kernel/messages/v1/kernel-info-request.schema.json", | ||
"version": 1, | ||
"title": "Kernel info request message", | ||
"type": "object", | ||
"properties": { | ||
"header": { | ||
"$ref": "/kernel/messages/v1/message-header.schema.json", | ||
"description": "Message header", | ||
"properties": { | ||
"msg_type": { | ||
"const": "kernel_info_request" | ||
} | ||
} | ||
}, | ||
"content": { | ||
"type": "object" | ||
} | ||
}, | ||
"required": [ | ||
"header", "content" | ||
] | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wrote a very similar class to this in Jupyter Events here.
I wonder if we can consolidate some of this logic.