nbformat.v4.4.schema.json 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459
  1. {
  2. "$schema": "http://json-schema.org/draft-04/schema#",
  3. "description": "Jupyter Notebook v4.4 JSON schema.",
  4. "type": "object",
  5. "additionalProperties": false,
  6. "required": ["metadata", "nbformat_minor", "nbformat", "cells"],
  7. "properties": {
  8. "metadata": {
  9. "description": "Notebook root-level metadata.",
  10. "type": "object",
  11. "additionalProperties": true,
  12. "properties": {
  13. "kernelspec": {
  14. "description": "Kernel information.",
  15. "type": "object",
  16. "required": ["name", "display_name"],
  17. "properties": {
  18. "name": {
  19. "description": "Name of the kernel specification.",
  20. "type": "string"
  21. },
  22. "display_name": {
  23. "description": "Name to display in UI.",
  24. "type": "string"
  25. }
  26. }
  27. },
  28. "language_info": {
  29. "description": "Kernel information.",
  30. "type": "object",
  31. "required": ["name"],
  32. "properties": {
  33. "name": {
  34. "description": "The programming language which this kernel runs.",
  35. "type": "string"
  36. },
  37. "codemirror_mode": {
  38. "description": "The codemirror mode to use for code in this language.",
  39. "oneOf": [{ "type": "string" }, { "type": "object" }]
  40. },
  41. "file_extension": {
  42. "description": "The file extension for files in this language.",
  43. "type": "string"
  44. },
  45. "mimetype": {
  46. "description": "The mimetype corresponding to files in this language.",
  47. "type": "string"
  48. },
  49. "pygments_lexer": {
  50. "description": "The pygments lexer to use for code in this language.",
  51. "type": "string"
  52. }
  53. }
  54. },
  55. "orig_nbformat": {
  56. "description": "Original notebook format (major number) before converting the notebook between versions. This should never be written to a file.",
  57. "type": "integer",
  58. "minimum": 1
  59. },
  60. "title": {
  61. "description": "The title of the notebook document",
  62. "type": "string"
  63. },
  64. "authors": {
  65. "description": "The author(s) of the notebook document",
  66. "type": "array",
  67. "item": {
  68. "type": "object",
  69. "properties": {
  70. "name": {
  71. "type": "string"
  72. }
  73. },
  74. "additionalProperties": true
  75. }
  76. }
  77. }
  78. },
  79. "nbformat_minor": {
  80. "description": "Notebook format (minor number). Incremented for backward compatible changes to the notebook format.",
  81. "type": "integer",
  82. "minimum": 4
  83. },
  84. "nbformat": {
  85. "description": "Notebook format (major number). Incremented between backwards incompatible changes to the notebook format.",
  86. "type": "integer",
  87. "minimum": 4,
  88. "maximum": 4
  89. },
  90. "cells": {
  91. "description": "Array of cells of the current notebook.",
  92. "type": "array",
  93. "items": { "$ref": "#/definitions/cell" }
  94. }
  95. },
  96. "definitions": {
  97. "cell": {
  98. "type": "object",
  99. "oneOf": [
  100. { "$ref": "#/definitions/raw_cell" },
  101. { "$ref": "#/definitions/markdown_cell" },
  102. { "$ref": "#/definitions/code_cell" }
  103. ]
  104. },
  105. "raw_cell": {
  106. "description": "Notebook raw nbconvert cell.",
  107. "type": "object",
  108. "additionalProperties": false,
  109. "required": ["cell_type", "metadata", "source"],
  110. "properties": {
  111. "cell_type": {
  112. "description": "String identifying the type of cell.",
  113. "enum": ["raw"]
  114. },
  115. "metadata": {
  116. "description": "Cell-level metadata.",
  117. "type": "object",
  118. "additionalProperties": true,
  119. "properties": {
  120. "format": {
  121. "description": "Raw cell metadata format for nbconvert.",
  122. "type": "string"
  123. },
  124. "jupyter": {
  125. "description": "Official Jupyter Metadata for Raw Cells",
  126. "type": "object",
  127. "additionalProperties": true,
  128. "source_hidden": {
  129. "description": "Whether the source is hidden.",
  130. "type": "boolean"
  131. }
  132. },
  133. "name": { "$ref": "#/definitions/misc/metadata_name" },
  134. "tags": { "$ref": "#/definitions/misc/metadata_tags" }
  135. }
  136. },
  137. "attachments": { "$ref": "#/definitions/misc/attachments" },
  138. "source": { "$ref": "#/definitions/misc/source" }
  139. }
  140. },
  141. "markdown_cell": {
  142. "description": "Notebook markdown cell.",
  143. "type": "object",
  144. "additionalProperties": false,
  145. "required": ["cell_type", "metadata", "source"],
  146. "properties": {
  147. "cell_type": {
  148. "description": "String identifying the type of cell.",
  149. "enum": ["markdown"]
  150. },
  151. "metadata": {
  152. "description": "Cell-level metadata.",
  153. "type": "object",
  154. "properties": {
  155. "name": { "$ref": "#/definitions/misc/metadata_name" },
  156. "tags": { "$ref": "#/definitions/misc/metadata_tags" },
  157. "jupyter": {
  158. "description": "Official Jupyter Metadata for Markdown Cells",
  159. "type": "object",
  160. "additionalProperties": true,
  161. "source_hidden": {
  162. "description": "Whether the source is hidden.",
  163. "type": "boolean"
  164. }
  165. }
  166. },
  167. "additionalProperties": true
  168. },
  169. "attachments": { "$ref": "#/definitions/misc/attachments" },
  170. "source": { "$ref": "#/definitions/misc/source" }
  171. }
  172. },
  173. "code_cell": {
  174. "description": "Notebook code cell.",
  175. "type": "object",
  176. "additionalProperties": false,
  177. "required": [
  178. "cell_type",
  179. "metadata",
  180. "source",
  181. "outputs",
  182. "execution_count"
  183. ],
  184. "properties": {
  185. "cell_type": {
  186. "description": "String identifying the type of cell.",
  187. "enum": ["code"]
  188. },
  189. "metadata": {
  190. "description": "Cell-level metadata.",
  191. "type": "object",
  192. "additionalProperties": true,
  193. "properties": {
  194. "jupyter": {
  195. "description": "Official Jupyter Metadata for Code Cells",
  196. "type": "object",
  197. "additionalProperties": true,
  198. "source_hidden": {
  199. "description": "Whether the source is hidden.",
  200. "type": "boolean"
  201. },
  202. "outputs_hidden": {
  203. "description": "Whether the outputs are hidden.",
  204. "type": "boolean"
  205. }
  206. },
  207. "execution": {
  208. "description": "Execution time for the code in the cell. This tracks time at which messages are received from iopub or shell channels",
  209. "type": "object",
  210. "properties": {
  211. "iopub.execute_input": {
  212. "description": "header.date (in ISO 8601 format) of iopub channel's execute_input message. It indicates the time at which the kernel broadcasts an execute_input message to connected frontends",
  213. "type": "string"
  214. },
  215. "iopub.status.busy": {
  216. "description": "header.date (in ISO 8601 format) of iopub channel's kernel status message when the status is 'busy'",
  217. "type": "string"
  218. },
  219. "shell.execute_reply": {
  220. "description": "header.date (in ISO 8601 format) of the shell channel's execute_reply message. It indicates the time at which the execute_reply message was created",
  221. "type": "string"
  222. },
  223. "iopub.status.idle": {
  224. "description": "header.date (in ISO 8601 format) of iopub channel's kernel status message when the status is 'idle'. It indicates the time at which kernel finished processing the associated request",
  225. "type": "string"
  226. }
  227. },
  228. "additionalProperties": true,
  229. "patternProperties": {
  230. "^.*$": {
  231. "type": "string"
  232. }
  233. }
  234. },
  235. "collapsed": {
  236. "description": "Whether the cell's output is collapsed/expanded.",
  237. "type": "boolean"
  238. },
  239. "scrolled": {
  240. "description": "Whether the cell's output is scrolled, unscrolled, or autoscrolled.",
  241. "enum": [true, false, "auto"]
  242. },
  243. "name": { "$ref": "#/definitions/misc/metadata_name" },
  244. "tags": { "$ref": "#/definitions/misc/metadata_tags" }
  245. }
  246. },
  247. "source": { "$ref": "#/definitions/misc/source" },
  248. "outputs": {
  249. "description": "Execution, display, or stream outputs.",
  250. "type": "array",
  251. "items": { "$ref": "#/definitions/output" }
  252. },
  253. "execution_count": {
  254. "description": "The code cell's prompt number. Will be null if the cell has not been run.",
  255. "type": ["integer", "null"],
  256. "minimum": 0
  257. }
  258. }
  259. },
  260. "unrecognized_cell": {
  261. "description": "Unrecognized cell from a future minor-revision to the notebook format.",
  262. "type": "object",
  263. "additionalProperties": true,
  264. "required": ["cell_type", "metadata"],
  265. "properties": {
  266. "cell_type": {
  267. "description": "String identifying the type of cell.",
  268. "not": {
  269. "enum": ["markdown", "code", "raw"]
  270. }
  271. },
  272. "metadata": {
  273. "description": "Cell-level metadata.",
  274. "type": "object",
  275. "properties": {
  276. "name": { "$ref": "#/definitions/misc/metadata_name" },
  277. "tags": { "$ref": "#/definitions/misc/metadata_tags" }
  278. },
  279. "additionalProperties": true
  280. }
  281. }
  282. },
  283. "output": {
  284. "type": "object",
  285. "oneOf": [
  286. { "$ref": "#/definitions/execute_result" },
  287. { "$ref": "#/definitions/display_data" },
  288. { "$ref": "#/definitions/stream" },
  289. { "$ref": "#/definitions/error" }
  290. ]
  291. },
  292. "execute_result": {
  293. "description": "Result of executing a code cell.",
  294. "type": "object",
  295. "additionalProperties": false,
  296. "required": ["output_type", "data", "metadata", "execution_count"],
  297. "properties": {
  298. "output_type": {
  299. "description": "Type of cell output.",
  300. "enum": ["execute_result"]
  301. },
  302. "execution_count": {
  303. "description": "A result's prompt number.",
  304. "type": ["integer", "null"],
  305. "minimum": 0
  306. },
  307. "data": { "$ref": "#/definitions/misc/mimebundle" },
  308. "metadata": { "$ref": "#/definitions/misc/output_metadata" }
  309. }
  310. },
  311. "display_data": {
  312. "description": "Data displayed as a result of code cell execution.",
  313. "type": "object",
  314. "additionalProperties": false,
  315. "required": ["output_type", "data", "metadata"],
  316. "properties": {
  317. "output_type": {
  318. "description": "Type of cell output.",
  319. "enum": ["display_data"]
  320. },
  321. "data": { "$ref": "#/definitions/misc/mimebundle" },
  322. "metadata": { "$ref": "#/definitions/misc/output_metadata" }
  323. }
  324. },
  325. "stream": {
  326. "description": "Stream output from a code cell.",
  327. "type": "object",
  328. "additionalProperties": false,
  329. "required": ["output_type", "name", "text"],
  330. "properties": {
  331. "output_type": {
  332. "description": "Type of cell output.",
  333. "enum": ["stream"]
  334. },
  335. "name": {
  336. "description": "The name of the stream (stdout, stderr).",
  337. "type": "string"
  338. },
  339. "text": {
  340. "description": "The stream's text output, represented as an array of strings.",
  341. "$ref": "#/definitions/misc/multiline_string"
  342. }
  343. }
  344. },
  345. "error": {
  346. "description": "Output of an error that occurred during code cell execution.",
  347. "type": "object",
  348. "additionalProperties": false,
  349. "required": ["output_type", "ename", "evalue", "traceback"],
  350. "properties": {
  351. "output_type": {
  352. "description": "Type of cell output.",
  353. "enum": ["error"]
  354. },
  355. "ename": {
  356. "description": "The name of the error.",
  357. "type": "string"
  358. },
  359. "evalue": {
  360. "description": "The value, or message, of the error.",
  361. "type": "string"
  362. },
  363. "traceback": {
  364. "description": "The error's traceback, represented as an array of strings.",
  365. "type": "array",
  366. "items": { "type": "string" }
  367. }
  368. }
  369. },
  370. "unrecognized_output": {
  371. "description": "Unrecognized output from a future minor-revision to the notebook format.",
  372. "type": "object",
  373. "additionalProperties": true,
  374. "required": ["output_type"],
  375. "properties": {
  376. "output_type": {
  377. "description": "Type of cell output.",
  378. "not": {
  379. "enum": ["execute_result", "display_data", "stream", "error"]
  380. }
  381. }
  382. }
  383. },
  384. "misc": {
  385. "metadata_name": {
  386. "description": "The cell's name. If present, must be a non-empty string. Cell names are expected to be unique across all the cells in a given notebook. This criterion cannot be checked by the json schema and must be established by an additional check.",
  387. "type": "string",
  388. "pattern": "^.+$"
  389. },
  390. "metadata_tags": {
  391. "description": "The cell's tags. Tags must be unique, and must not contain commas.",
  392. "type": "array",
  393. "uniqueItems": true,
  394. "items": {
  395. "type": "string",
  396. "pattern": "^[^,]+$"
  397. }
  398. },
  399. "attachments": {
  400. "description": "Media attachments (e.g. inline images), stored as mimebundle keyed by filename.",
  401. "type": "object",
  402. "patternProperties": {
  403. ".*": {
  404. "description": "The attachment's data stored as a mimebundle.",
  405. "$ref": "#/definitions/misc/mimebundle"
  406. }
  407. }
  408. },
  409. "source": {
  410. "description": "Contents of the cell, represented as an array of lines.",
  411. "$ref": "#/definitions/misc/multiline_string"
  412. },
  413. "execution_count": {
  414. "description": "The code cell's prompt number. Will be null if the cell has not been run.",
  415. "type": ["integer", "null"],
  416. "minimum": 0
  417. },
  418. "mimebundle": {
  419. "description": "A mime-type keyed dictionary of data",
  420. "type": "object",
  421. "additionalProperties": {
  422. "description": "mimetype output (e.g. text/plain), represented as either an array of strings or a string.",
  423. "$ref": "#/definitions/misc/multiline_string"
  424. },
  425. "patternProperties": {
  426. "^application/(.*\\+)?json$": {
  427. "description": "Mimetypes with JSON output, can be any type"
  428. }
  429. }
  430. },
  431. "output_metadata": {
  432. "description": "Cell output metadata.",
  433. "type": "object",
  434. "additionalProperties": true
  435. },
  436. "multiline_string": {
  437. "oneOf": [
  438. { "type": "string" },
  439. {
  440. "type": "array",
  441. "items": { "type": "string" }
  442. }
  443. ]
  444. }
  445. }
  446. }
  447. }