nbformat.v4.3.schema.json 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431
  1. {
  2. "$schema": "http://json-schema.org/draft-04/schema#",
  3. "description": "Jupyter Notebook v4.3 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": 3
  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. "collapsed": {
  208. "description": "Whether the cell is collapsed/expanded.",
  209. "type": "boolean"
  210. },
  211. "scrolled": {
  212. "description": "Whether the cell's output is scrolled, unscrolled, or autoscrolled.",
  213. "enum": [true, false, "auto"]
  214. },
  215. "name": { "$ref": "#/definitions/misc/metadata_name" },
  216. "tags": { "$ref": "#/definitions/misc/metadata_tags" }
  217. }
  218. },
  219. "source": { "$ref": "#/definitions/misc/source" },
  220. "outputs": {
  221. "description": "Execution, display, or stream outputs.",
  222. "type": "array",
  223. "items": { "$ref": "#/definitions/output" }
  224. },
  225. "execution_count": {
  226. "description": "The code cell's prompt number. Will be null if the cell has not been run.",
  227. "type": ["integer", "null"],
  228. "minimum": 0
  229. }
  230. }
  231. },
  232. "unrecognized_cell": {
  233. "description": "Unrecognized cell from a future minor-revision to the notebook format.",
  234. "type": "object",
  235. "additionalProperties": true,
  236. "required": ["cell_type", "metadata"],
  237. "properties": {
  238. "cell_type": {
  239. "description": "String identifying the type of cell.",
  240. "not": {
  241. "enum": ["markdown", "code", "raw"]
  242. }
  243. },
  244. "metadata": {
  245. "description": "Cell-level metadata.",
  246. "type": "object",
  247. "properties": {
  248. "name": { "$ref": "#/definitions/misc/metadata_name" },
  249. "tags": { "$ref": "#/definitions/misc/metadata_tags" }
  250. },
  251. "additionalProperties": true
  252. }
  253. }
  254. },
  255. "output": {
  256. "type": "object",
  257. "oneOf": [
  258. { "$ref": "#/definitions/execute_result" },
  259. { "$ref": "#/definitions/display_data" },
  260. { "$ref": "#/definitions/stream" },
  261. { "$ref": "#/definitions/error" }
  262. ]
  263. },
  264. "execute_result": {
  265. "description": "Result of executing a code cell.",
  266. "type": "object",
  267. "additionalProperties": false,
  268. "required": ["output_type", "data", "metadata", "execution_count"],
  269. "properties": {
  270. "output_type": {
  271. "description": "Type of cell output.",
  272. "enum": ["execute_result"]
  273. },
  274. "execution_count": {
  275. "description": "A result's prompt number.",
  276. "type": ["integer", "null"],
  277. "minimum": 0
  278. },
  279. "data": { "$ref": "#/definitions/misc/mimebundle" },
  280. "metadata": { "$ref": "#/definitions/misc/output_metadata" }
  281. }
  282. },
  283. "display_data": {
  284. "description": "Data displayed as a result of code cell execution.",
  285. "type": "object",
  286. "additionalProperties": false,
  287. "required": ["output_type", "data", "metadata"],
  288. "properties": {
  289. "output_type": {
  290. "description": "Type of cell output.",
  291. "enum": ["display_data"]
  292. },
  293. "data": { "$ref": "#/definitions/misc/mimebundle" },
  294. "metadata": { "$ref": "#/definitions/misc/output_metadata" }
  295. }
  296. },
  297. "stream": {
  298. "description": "Stream output from a code cell.",
  299. "type": "object",
  300. "additionalProperties": false,
  301. "required": ["output_type", "name", "text"],
  302. "properties": {
  303. "output_type": {
  304. "description": "Type of cell output.",
  305. "enum": ["stream"]
  306. },
  307. "name": {
  308. "description": "The name of the stream (stdout, stderr).",
  309. "type": "string"
  310. },
  311. "text": {
  312. "description": "The stream's text output, represented as an array of strings.",
  313. "$ref": "#/definitions/misc/multiline_string"
  314. }
  315. }
  316. },
  317. "error": {
  318. "description": "Output of an error that occurred during code cell execution.",
  319. "type": "object",
  320. "additionalProperties": false,
  321. "required": ["output_type", "ename", "evalue", "traceback"],
  322. "properties": {
  323. "output_type": {
  324. "description": "Type of cell output.",
  325. "enum": ["error"]
  326. },
  327. "ename": {
  328. "description": "The name of the error.",
  329. "type": "string"
  330. },
  331. "evalue": {
  332. "description": "The value, or message, of the error.",
  333. "type": "string"
  334. },
  335. "traceback": {
  336. "description": "The error's traceback, represented as an array of strings.",
  337. "type": "array",
  338. "items": { "type": "string" }
  339. }
  340. }
  341. },
  342. "unrecognized_output": {
  343. "description": "Unrecognized output from a future minor-revision to the notebook format.",
  344. "type": "object",
  345. "additionalProperties": true,
  346. "required": ["output_type"],
  347. "properties": {
  348. "output_type": {
  349. "description": "Type of cell output.",
  350. "not": {
  351. "enum": ["execute_result", "display_data", "stream", "error"]
  352. }
  353. }
  354. }
  355. },
  356. "misc": {
  357. "metadata_name": {
  358. "description": "The cell's name. If present, must be a non-empty string. Must be unique across all the cells of a given notebook.",
  359. "type": "string",
  360. "pattern": "^.+$"
  361. },
  362. "metadata_tags": {
  363. "description": "The cell's tags. Tags must be unique, and must not contain commas.",
  364. "type": "array",
  365. "uniqueItems": true,
  366. "items": {
  367. "type": "string",
  368. "pattern": "^[^,]+$"
  369. }
  370. },
  371. "attachments": {
  372. "description": "Media attachments (e.g. inline images), stored as mimebundle keyed by filename.",
  373. "type": "object",
  374. "patternProperties": {
  375. ".*": {
  376. "description": "The attachment's data stored as a mimebundle.",
  377. "$ref": "#/definitions/misc/mimebundle"
  378. }
  379. }
  380. },
  381. "source": {
  382. "description": "Contents of the cell, represented as an array of lines.",
  383. "$ref": "#/definitions/misc/multiline_string"
  384. },
  385. "execution_count": {
  386. "description": "The code cell's prompt number. Will be null if the cell has not been run.",
  387. "type": ["integer", "null"],
  388. "minimum": 0
  389. },
  390. "mimebundle": {
  391. "description": "A mime-type keyed dictionary of data",
  392. "type": "object",
  393. "additionalProperties": {
  394. "description": "mimetype output (e.g. text/plain), represented as either an array of strings or a string.",
  395. "$ref": "#/definitions/misc/multiline_string"
  396. },
  397. "patternProperties": {
  398. "^application/(.*\\+)?json$": {
  399. "description": "Mimetypes with JSON output, can be any type"
  400. }
  401. }
  402. },
  403. "output_metadata": {
  404. "description": "Cell output metadata.",
  405. "type": "object",
  406. "additionalProperties": true
  407. },
  408. "multiline_string": {
  409. "oneOf": [
  410. { "type": "string" },
  411. {
  412. "type": "array",
  413. "items": { "type": "string" }
  414. }
  415. ]
  416. }
  417. }
  418. }
  419. }