Post

Jupyter-notebook

  • jupyter-notebook .ipynb file is json with fields code, comment and field to memorize the execution result of code field content.

The workflow (pseudocode) looks like as following:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
json=ReadFileAsJson(ipynb)
renderAsHtml(json)
 
# User clicks `div` with cells[1].source content

obj=json.cells[1]
								
if obj.cell_type == "code":
  result = (py obj.source)
  obj.metadata.ExecuteTime = result.executeTime
  obj.metadata.outputs = result.output
  obj.execution_count++

update(obj, json)
renderAsHtml(json)
This post is licensed under CC BY 4.0 by the author.