Public API
Tutorial SDK public API.
AuthorSpec
Bases: BaseModel
Tutorial author metadata.
Source code in src/tutorial_sdk/spec.py
14 15 16 17 18 19 20 | |
BuildSpec
Bases: BaseModel
Build artifact and container image configuration.
Source code in src/tutorial_sdk/spec.py
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | |
ContentSpec
Bases: BaseModel
Tutorial content assets copied into the image.
Source code in src/tutorial_sdk/spec.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | |
all_paths
all_paths() -> list[str]
Return every declared content path in stable order.
Source code in src/tutorial_sdk/spec.py
58 59 60 61 62 63 64 65 66 67 68 | |
DependencySpec
Bases: BaseModel
Package dependencies declared by package manager.
Source code in src/tutorial_sdk/spec.py
35 36 37 38 39 40 41 42 43 | |
DockerfileSections
Bases: BaseModel
Optional user-managed Dockerfile snippets.
Source code in src/tutorial_sdk/spec.py
71 72 73 74 75 76 77 78 | |
EntrypointSpec
Bases: BaseModel
Default runtime entrypoint.
Source code in src/tutorial_sdk/spec.py
110 111 112 113 114 115 116 117 | |
RuntimeSpec
Bases: BaseModel
Runtime configuration for a tutorial environment.
Source code in src/tutorial_sdk/spec.py
23 24 25 26 27 28 29 30 31 32 | |
TutorialProject
High-level API for tutorial projects.
Source code in src/tutorial_sdk/project.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 | |
__init__
__init__(spec: TutorialSpec, root: str | Path = '.', config_path: str | Path = DEFAULT_CONFIG) -> None
Create a tutorial project object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spec
|
TutorialSpec
|
Parsed tutorial specification. |
required |
root
|
str | Path
|
Project root directory. |
'.'
|
config_path
|
str | Path
|
Path to the tutorial YAML configuration file. |
DEFAULT_CONFIG
|
Source code in src/tutorial_sdk/project.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | |
build
build(image: str | None = None, no_cache: bool | None = None, platform: str | None = None) -> BuildResult
Generate a Dockerfile and build the container image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image
|
str | None
|
Optional image tag override. |
None
|
no_cache
|
bool | None
|
If |
None
|
platform
|
str | None
|
Target platform (e.g.
|
None
|
Returns:
| Type | Description |
|---|---|
BuildResult
|
A |
Source code in src/tutorial_sdk/project.py
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 | |
init
classmethod
init(path: str | Path = '.') -> TutorialProject
Create a minimal tutorial project skeleton.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
Target directory for the new project. |
'.'
|
Returns:
| Type | Description |
|---|---|
TutorialProject
|
A |
Source code in src/tutorial_sdk/project.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | |
init_from
classmethod
init_from(source: str | Path, target: str | Path | None = None) -> TutorialProject
Import an existing directory as a tutorial project.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
str | Path
|
Path to an existing directory containing notebooks and associated files. |
required |
target
|
str | Path | None
|
Optional target directory for the new tutorial project. |
None
|
Returns:
| Type | Description |
|---|---|
TutorialProject
|
A fully initialised |
Source code in src/tutorial_sdk/project.py
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | |
init_from_github
classmethod
init_from_github(org_repo: str, target: str | Path | None = None, remove_clone: bool = False) -> TutorialProject
Import a GitHub repository as a tutorial project.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
org_repo
|
str
|
|
required |
target
|
str | Path | None
|
Optional target directory. |
None
|
remove_clone
|
bool
|
If |
False
|
Returns:
| Type | Description |
|---|---|
TutorialProject
|
A |
Source code in src/tutorial_sdk/project.py
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | |
init_from_url
classmethod
init_from_url(url: str, target: str | Path | None = None, remove_clone: bool = False) -> TutorialProject
Import a remote repository as a tutorial project.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
url
|
str
|
Git-compatible clone URL. |
required |
target
|
str | Path | None
|
Optional target directory. |
None
|
remove_clone
|
bool
|
If |
False
|
Returns:
| Type | Description |
|---|---|
TutorialProject
|
A |
Source code in src/tutorial_sdk/project.py
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | |
inspect
inspect() -> str
Return resolved tutorial metadata as JSON.
Returns:
| Type | Description |
|---|---|
str
|
Pretty-printed JSON string. |
Source code in src/tutorial_sdk/project.py
210 211 212 213 214 215 216 217 218 219 220 221 222 | |
load
classmethod
load(path: str | Path) -> TutorialProject
Load a tutorial project from a YAML specification.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
Path to a tutorial YAML file. |
required |
Returns:
| Type | Description |
|---|---|
TutorialProject
|
A |
Source code in src/tutorial_sdk/project.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | |
resolve
resolve() -> ResolvedTutorialProject
Resolve the project content graph.
Returns:
| Type | Description |
|---|---|
ResolvedTutorialProject
|
A |
Source code in src/tutorial_sdk/project.py
160 161 162 163 164 165 166 167 168 169 170 171 | |
run
run(image: str | None = None, port: int = 8888, shell: bool = False) -> RunResult
Run the tutorial container locally.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image
|
str | None
|
Optional image tag override. |
None
|
port
|
int
|
Host port to bind. |
8888
|
shell
|
bool
|
If |
False
|
Returns:
| Type | Description |
|---|---|
RunResult
|
A |
Source code in src/tutorial_sdk/project.py
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 | |
validate
validate(strict: bool = False, container: bool = False, image: str | None = None) -> ValidationReport
Run configured validation checks.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
strict
|
bool
|
If |
False
|
container
|
bool
|
If |
False
|
image
|
str | None
|
Override image tag for container validation. |
None
|
Returns:
| Type | Description |
|---|---|
ValidationReport
|
Combined |
Source code in src/tutorial_sdk/project.py
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | |
TutorialSpec
Bases: BaseModel
Source-of-truth tutorial specification.
Source code in src/tutorial_sdk/spec.py
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | |
display_title
property
display_title: str
Return the title exposed in generated metadata.
load
classmethod
load(path: str | Path) -> TutorialSpec
Load a tutorial specification from YAML.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
Path to a tutorial YAML file. |
required |
Returns:
| Type | Description |
|---|---|
TutorialSpec
|
Parsed tutorial specification. |
Raises:
| Type | Description |
|---|---|
ConfigError
|
If the file cannot be read or validated. |
Source code in src/tutorial_sdk/spec.py
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | |
to_manifest_dict
to_manifest_dict(image: str | None = None) -> dict[str, Any]
Return the reproducibility manifest payload.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image
|
str | None
|
Override image tag. Falls back to the build spec's configured image. |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Dictionary suitable for JSON serialisation. |
Source code in src/tutorial_sdk/spec.py
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | |
validate_name
classmethod
validate_name(value: str) -> str
Validate the spec name used for files and image tags.
Source code in src/tutorial_sdk/spec.py
138 139 140 141 142 143 144 145 146 147 148 149 | |
write
write(path: str | Path) -> None
Write this specification as YAML.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
Destination file path. |
required |
Source code in src/tutorial_sdk/spec.py
184 185 186 187 188 189 190 191 192 193 | |
ValidationCheck
Bases: BaseModel
A single validation check result.
Source code in src/tutorial_sdk/validator/report.py
9 10 11 12 13 14 15 16 | |
ValidationReport
Bases: BaseModel
Machine-readable tutorial validation report.
Source code in src/tutorial_sdk/validator/report.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | |
combine
classmethod
combine(reports: list[ValidationReport]) -> ValidationReport
Combine several reports into one report.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
reports
|
list[ValidationReport]
|
List of reports to merge. |
required |
Returns:
| Type | Description |
|---|---|
ValidationReport
|
A single |
Source code in src/tutorial_sdk/validator/report.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | |
render_json
render_json() -> str
Render report as stable JSON.
Returns:
| Type | Description |
|---|---|
str
|
Pretty-printed JSON string. |
Source code in src/tutorial_sdk/validator/report.py
58 59 60 61 62 63 64 65 | |
write
write(path: str | Path) -> None
Write report JSON to disk.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
Destination file path. |
required |
Source code in src/tutorial_sdk/validator/report.py
67 68 69 70 71 72 73 74 75 76 77 | |
ValidationSpec
Bases: BaseModel
Validation checks enabled for a tutorial.
Source code in src/tutorial_sdk/spec.py
99 100 101 102 103 104 105 106 107 | |