or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

cell-interfaces.mdindex.mdmime-validation.mdnotebook-metadata.mdoutput-interfaces.md
tile.json

notebook-metadata.mddocs/

0

# Notebook and Metadata

1

2

Core interfaces for notebook documents, metadata structures, and format specifications. These interfaces define the overall structure of Jupyter notebooks and their associated metadata.

3

4

## Capabilities

5

6

### Notebook Document Interface

7

8

The main interface representing a complete Jupyter notebook document.

9

10

```typescript { .api }

11

/**

12

* The notebook content interface representing a complete Jupyter notebook

13

*/

14

interface INotebookContent extends PartialJSONObject {

15

/** Notebook-level metadata */

16

metadata: INotebookMetadata;

17

/** Minor version of the nbformat specification */

18

nbformat_minor: number;

19

/** Major version of the nbformat specification */

20

nbformat: number;

21

/** Array of cells in the notebook */

22

cells: ICell[];

23

}

24

```

25

26

**Usage Example:**

27

28

```typescript

29

import { INotebookContent } from "@jupyterlab/nbformat";

30

31

const notebook: INotebookContent = {

32

metadata: {

33

kernelspec: {

34

name: "python3",

35

display_name: "Python 3"

36

}

37

},

38

nbformat: 4,

39

nbformat_minor: 4,

40

cells: []

41

};

42

```

43

44

### Notebook Metadata Interface

45

46

Metadata structure containing notebook-level configuration and information.

47

48

```typescript { .api }

49

/**

50

* The default metadata for the notebook

51

*/

52

interface INotebookMetadata extends PartialJSONObject {

53

/** Kernel specification metadata */

54

kernelspec?: IKernelspecMetadata;

55

/** Programming language information */

56

language_info?: ILanguageInfoMetadata;

57

/** Original nbformat version */

58

orig_nbformat?: number;

59

}

60

```

61

62

### Kernelspec Metadata Interface

63

64

Kernel specification information describing the computational backend.

65

66

```typescript { .api }

67

/**

68

* The kernelspec metadata describing the computational kernel

69

*/

70

interface IKernelspecMetadata extends PartialJSONObject {

71

/** Internal name of the kernel */

72

name: string;

73

/** Human-readable display name */

74

display_name: string;

75

}

76

```

77

78

**Usage Example:**

79

80

```typescript

81

import { IKernelspecMetadata } from "@jupyterlab/nbformat";

82

83

const kernelspec: IKernelspecMetadata = {

84

name: "python3",

85

display_name: "Python 3"

86

};

87

```

88

89

### Language Info Metadata Interface

90

91

Programming language configuration and metadata.

92

93

```typescript { .api }

94

/**

95

* The language info metadata describing programming language settings

96

*/

97

interface ILanguageInfoMetadata extends PartialJSONObject {

98

/** Programming language name */

99

name: string;

100

/** CodeMirror mode configuration */

101

codemirror_mode?: string | PartialJSONObject;

102

/** Default file extension for the language */

103

file_extension?: string;

104

/** MIME type for the language */

105

mimetype?: string;

106

/** Pygments lexer name for syntax highlighting */

107

pygments_lexer?: string;

108

}

109

```

110

111

**Usage Example:**

112

113

```typescript

114

import { ILanguageInfoMetadata } from "@jupyterlab/nbformat";

115

116

const languageInfo: ILanguageInfoMetadata = {

117

name: "python",

118

codemirror_mode: {

119

name: "ipython",

120

version: 3

121

},

122

file_extension: ".py",

123

mimetype: "text/x-python",

124

pygments_lexer: "ipython3"

125

};

126

```

127

128

### Version Constants

129

130

Constants defining the supported nbformat specification versions.

131

132

```typescript { .api }

133

/**

134

* The earliest major version of the notebook format we support

135

*/

136

const MAJOR_VERSION: number;

137

138

/**

139

* The earliest minor version of the notebook format we support

140

*/

141

const MINOR_VERSION: number;

142

```

143

144

**Usage Example:**

145

146

```typescript

147

import { MAJOR_VERSION, MINOR_VERSION } from "@jupyterlab/nbformat";

148

149

console.log(`Supporting nbformat ${MAJOR_VERSION}.${MINOR_VERSION}+`);

150

151

// Check notebook compatibility

152

function isCompatible(notebook: INotebookContent): boolean {

153

return notebook.nbformat >= MAJOR_VERSION &&

154

notebook.nbformat_minor >= MINOR_VERSION;

155

}

156

```