Skip to content

Commit

Permalink
Doc build
Browse files Browse the repository at this point in the history
  • Loading branch information
ianthomas23 committed Feb 23, 2024
1 parent 7370ded commit 9fba739
Show file tree
Hide file tree
Showing 6 changed files with 242 additions and 0 deletions.
20 changes: 20 additions & 0 deletions docs/Makefile
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)
31 changes: 31 additions & 0 deletions docs/conf.py
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']
129 changes: 129 additions & 0 deletions docs/example.rst
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
21 changes: 21 additions & 0 deletions docs/index.rst
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`
35 changes: 35 additions & 0 deletions docs/make.bat
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
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ Source = "https://github.com/unknown/jupyter-schemas"
test = [
"pytest",
]
docs = [
"pydata_sphinx_theme",
"sphinx",
"sphinx_design",
"sphinx-jsonschema",
]

[tool.hatch.version]
path = "jupyter_schemas.py"
Expand Down

0 comments on commit 9fba739

Please sign in to comment.