Skip to content

Commit 7636f21

Browse files
authored
Merge pull request #348 from mwouts/docs_use_myst_parser
Render .md files on RTD with MyST-parser
2 parents f05f948 + 857b0fa commit 7636f21

13 files changed

+35
-44
lines changed

docs/environment.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ dependencies:
66
- python=3.7
77
- sphinx
88
- sphinx_rtd_theme
9-
- recommonmark
109
- pillow
1110
- pip
1211
- pip:
13-
- readthedocs-sphinx-ext
12+
- myst_parser
13+
- readthedocs-sphinx-ext

docs/source/conf.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313
import os
1414
import shlex
1515

16-
# Needed for conversion from markdown to html
17-
import recommonmark.parser
18-
1916
# If extensions (or modules to document with autodoc) are in another directory,
2017
# add these directories to sys.path here. If the directory is relative to the
2118
# documentation root, use os.path.abspath to make it absolute, like shown here.
@@ -35,17 +32,12 @@
3532
'sphinx.ext.napoleon',
3633
"sphinx.ext.extlinks",
3734
"sphinx.ext.viewcode",
38-
"recommonmark"
35+
"myst_parser"
3936
]
4037

4138
# Add any paths that contain templates here, relative to this directory.
4239
templates_path = ['_templates']
4340

44-
# Jupyter uses recommonmark's parser to convert markdown
45-
source_parsers = {
46-
'.md': 'recommonmark.parser.CommonMarkParser',
47-
}
48-
4941
# The suffix(es) of source filenames.
5042
# You can specify multiple suffix as a list of string:
5143
# source_suffix = ['.rst', '.md']

docs/source/config-options.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Configuration options
1+
# Configuration options
22

33
The kernel gateway adheres to the [Jupyter common configuration approach](https://jupyter.readthedocs.io/en/latest/projects/config.html). You can configure an instance of the kernel gateway using:
44

docs/source/devinstall.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
## Development Workflow
1+
# Development Workflow
22

33
This document includes instructions for setting up a development environment
44
for the Jupyter Kernel Gateway. It also includes common steps in the developer
55
workflow such as running tests, building docs, updating specs, etc.
66

7-
### Prerequisites
7+
## Prerequisites
88

99
Install [miniconda](https://conda.io/miniconda.html) and GNU make on your system.
1010

11-
### Clone the repo
11+
## Clone the repo
1212

1313
Clone this repository in a local directory.
1414

@@ -21,7 +21,7 @@ cd !$
2121
git clone https://github.com/jupyter/kernel_gateway.git
2222
```
2323

24-
### Build a conda environment
24+
## Build a conda environment
2525

2626
Build a Python 3 conda environment containing the necessary dependencies for
2727
running the kernel gateway, running tests, and building documentation.
@@ -30,15 +30,15 @@ running the kernel gateway, running tests, and building documentation.
3030
make env
3131
```
3232

33-
### Run the tests
33+
## Run the tests
3434

3535
Run the tests suite.
3636

3737
```bash
3838
make test
3939
```
4040

41-
### Run the gateway server
41+
## Run the gateway server
4242

4343
Run an instance of the kernel gateway server in [`jupyter-websocket` mode](websocket-mode.md).
4444

@@ -56,15 +56,15 @@ make dev-http
5656

5757
Then access the running server at the URL printed in the console.
5858

59-
### Build the docs
59+
## Build the docs
6060

6161
Run Sphinx to build the HTML documentation.
6262

6363
```bash
6464
make docs
6565
```
6666

67-
### Update the Swagger API spec
67+
## Update the Swagger API spec
6868

6969
After modifying any of the APIs in `jupyter-websocket` mode, you must update the project's Swagger API specification.
7070

docs/source/features.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Features
1+
# Features
22

33
The Jupyter Kernel Gateway has the following features:
44

docs/source/getting-started.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
## Getting started
1+
# Getting started
22

33
This document describes some of the basics of installing and running the
44
Jupyter Kernel Gateway.
55

6-
### Using pip
6+
## Using pip
77

88
We make stable releases of the kernel gateway to PyPI. You can use `pip` to install the latest version along with its dependencies.
99

@@ -19,7 +19,7 @@ Once installed, you can use the `jupyter` CLI to run the server.
1919
jupyter kernelgateway
2020
```
2121

22-
### Using conda
22+
## Using conda
2323

2424
You can install the kernel gateway using conda as well.
2525

@@ -29,7 +29,7 @@ conda install -c conda-forge jupyter_kernel_gateway
2929

3030
Once installed, you can use the `jupyter` CLI to run the server as shown above.
3131

32-
### Using a docker-stacks image
32+
## Using a docker-stacks image
3333

3434
You can add the kernel gateway to any [docker-stacks](https://github.com/jupyter/docker-stacks) image by writing a Dockerfile patterned after the following example:
3535

docs/source/http-mode.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## `notebook-http` Mode
1+
# `notebook-http` Mode
22

33
The `KernelGatewayApp.api` command line argument can be set to `kernel_gateway.notebook_http`. This mode, or *personality*, has the kernel gateway expose annotated cells in the `KernelGatewayApp.seed_uri` notebook as HTTP resources.
44

@@ -21,7 +21,7 @@ print("I'm cell #1")
2121
print("I'm cell #2")
2222
```
2323

24-
### Getting the Request Data
24+
## Getting the Request Data
2525

2626
Before the gateway invokes an annotated cell, it sets the value of a global notebook variable named `REQUEST` to a JSON string containing information about the request. You may parse this string to access the request properties.
2727

@@ -46,7 +46,7 @@ The `REQUEST` object currently contains the following properties:
4646
* `path` - An object of key-value pairs representing path parameters and their values.
4747
* `headers` - An object of key-value pairs where a key is a HTTP header name and a value is the HTTP header value. If there are multiple values are specified for a header, the value will be an array.
4848

49-
#### Request Content-Type and Request Body Processing
49+
### Request Content-Type and Request Body Processing
5050

5151
If the HTTP request to the kernel gateway has a `Content-Type` header the value of `REQUEST.body` may change. Below is the list of outcomes for various mime-types:
5252

@@ -55,7 +55,7 @@ If the HTTP request to the kernel gateway has a `Content-Type` header the value
5555
* `text/plain` - The `REQUEST.body` will be the string value of the body
5656
* All other types will be sent as strings
5757

58-
### Setting the Response Body
58+
## Setting the Response Body
5959

6060
The response from an annotated cell may be set in one of two ways:
6161

@@ -70,7 +70,7 @@ In both cases, the response defaults to status `200 OK` and `Content-Type: text/
7070

7171
See the [api_intro.ipynb](https://github.com/jupyter/kernel_gateway/blob/master/etc/api_examples/api_intro.ipynb) notebook for basic request and response examples.
7272

73-
### Setting the Response Status and Headers
73+
## Setting the Response Status and Headers
7474

7575
Annotated cells may have an optional metadata companion cell that sets the HTTP response status and headers. Consider this Python cell that creates a person entry in a database table and returns the new row ID in a JSON object:
7676

@@ -107,13 +107,13 @@ Content-Type: application/json
107107

108108
See the [setting_response_metadata.ipynb](https://github.com/jupyter/kernel_gateway/blob/master/etc/api_examples/setting_response_metadata.ipynb) notebook for examples of setting response metadata.
109109

110-
### Swagger Spec
110+
## Swagger Spec
111111

112112
The resource `/_api/spec/swagger.json` is automatically generated from the notebook used to define the HTTP API. The response is a simple Swagger spec which can be used with the [Swagger editor](http://editor.swagger.io/#), a [Swagger ui](https://github.com/swagger-api/swagger-ui), or with any other Swagger-aware tool.
113113

114114
Currently, every response is listed as having a status of `200 OK`.
115115

116-
### Running
116+
## Running
117117

118118
The minimum number of arguments needed to run in HTTP mode are `--KernelGatewayApp.api=kernel_gateway.notebook_http` and `--KernelGatewayApp.seed_uri=some/notebook/file.ipynb`.
119119

docs/source/plug-in.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Developing New Modes
1+
# Developing New Modes
22

33
The `KernelGatewayApp.api` can be set to the name of any module in the Python path supplying a personality. This allows for alternate kernel communications mechanisms.
44

@@ -36,5 +36,4 @@ def create_personality(self, parent):
3636
return TemplatePersonality(parent=parent)
3737
```
3838

39-
Provided personalities include
40-
[kernel_gateway.jupyter_websocket](_modules/kernel_gateway/jupyter_websocket.html) and [kernel_gateway.notebook_http](_modules/kernel_gateway/notebook_http.html).
39+
Provided personalities include [kernel_gateway.jupyter_websocket](websocket-mode.md) and [kernel_gateway.notebook_http](http-mode.md).

docs/source/summary-changes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
See `git log` for a more detailed summary of changes.
44
## 2.4
55

6-
## 2.4.0 (2019-08-11)
6+
### 2.4.0 (2019-08-11)
77

88
* [PR-323](https://github.com/jupyter/kernel_gateway/pull/323): Update handler not use deprecated maybe_future call
99
* [PR-322](https://github.com/jupyter/kernel_gateway/pull/322): Update handler compatibility with tornado/pyzmq updates

docs/source/troubleshooting.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
## Troubleshooting
1+
# Troubleshooting
22

3-
### I can't access kernel gateway in my Docker container.
3+
## I can't access kernel gateway in my Docker container.
44

55
The kernel gateway server listens on port 8888 by default. Make sure this internal port is exposed on an external port when starting the container. For example, if you run:
66

@@ -10,6 +10,6 @@ docker run -it --rm -p 9000:8888 jupyter/minimal-kernel
1010

1111
you can access your kernel gateway on the IP address of your Docker host an port 9000.
1212

13-
### Kernel gateway raises an error when I use `notebook-http` mode.
13+
## Kernel gateway raises an error when I use `notebook-http` mode.
1414

1515
The `notebook-http` mode publishes a web API defined by annotations and code in a notebook. Make sure you are specifying a path or URL of a notebook (`*.ipynb`) file when you launch the kernel gateway in this mode. Set the `--KernelGatewayApp.seed_uri` command line parameter or `KG_SEED_URI` environment variable to do so.

docs/source/uses.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Use Cases
1+
# Use Cases
22

33
The Jupyter Kernel Gateway makes possible the following novel uses of kernels:
44

docs/source/websocket-mode.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
## `jupyter-websocket` Mode
1+
# `jupyter-websocket` Mode
22

33
The `KernelGatewayApp.api` command line argument defaults to `kernel_gateway.jupyter_websocket`. This mode, or *personality*, has the kernel gateway expose:
44

55
1. a superset of the HTTP API provided by the Jupyter Notebook server, and
66
2. the equivalent Websocket API implemented by the Jupyter Notebook server.
77

8-
### HTTP Resources
8+
## HTTP Resources
99

1010
The HTTP API consists of kernel, session, monitoring, and metadata resources. All of these are documented in a [swagger.yaml](https://github.com/jupyter/kernel_gateway/blob/master/kernel_gateway/jupyter_websocket/swagger.yaml) file. You can use the [Swagger UI](http://petstore.swagger.io) to interact with a running instance of the kernel gateway by pointing the tool to the `/api/swagger.json` resource.
1111

12-
### Websocket Resources
12+
## Websocket Resources
1313

1414
The `/api/kernels/{kernel_id}/channels` resource multiplexes the [Jupyter kernel messaging protocol](https://jupyter-client.readthedocs.io/en/latest/messaging.html) over a single Websocket connection.
1515

requirements-doc.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
sphinx_rtd_theme
22
sphinx
3-
recommonmark
3+
myst-parser

0 commit comments

Comments
 (0)