Available Modules
Orchestration
tutorial_sdk.project.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 | |
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 | |
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_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 | |
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 | |
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 | |
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 | |
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 | |
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 | |
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 | |
tutorial_sdk.resolver.ResolvedTutorialProject
dataclass
A specification with project-relative paths resolved.
Source code in src/tutorial_sdk/resolver.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | |
image
property
image: str
Return the configured or default image tag.
tutorial_sdk.resolver.TutorialResolver
Resolve content and generated artifact paths.
Source code in src/tutorial_sdk/resolver.py
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 | |
__init__
__init__(spec: TutorialSpec, root: str | Path) -> None
Create a resolver.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spec
|
TutorialSpec
|
Parsed tutorial specification. |
required |
root
|
str | Path
|
Tutorial project root directory. |
required |
Source code in src/tutorial_sdk/resolver.py
30 31 32 33 34 35 36 37 38 39 | |
resolve
resolve(config_path: str | Path = DEFAULT_CONFIG) -> ResolvedTutorialProject
Resolve declared content files.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config_path
|
str | Path
|
Path to the configuration file associated with this project. |
DEFAULT_CONFIG
|
Returns:
| Type | Description |
|---|---|
ResolvedTutorialProject
|
A |
Source code in src/tutorial_sdk/resolver.py
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 | |
Specification Models
tutorial_sdk.spec.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.
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 | |
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 | |
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 | |
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 | |
tutorial_sdk.spec.AuthorSpec
Bases: BaseModel
Tutorial author metadata.
Source code in src/tutorial_sdk/spec.py
14 15 16 17 18 19 20 | |
tutorial_sdk.spec.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 | |
tutorial_sdk.spec.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 | |
tutorial_sdk.spec.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 | |
tutorial_sdk.spec.DockerfileSections
Bases: BaseModel
Optional user-managed Dockerfile snippets.
Source code in src/tutorial_sdk/spec.py
71 72 73 74 75 76 77 78 | |
tutorial_sdk.spec.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 | |
tutorial_sdk.spec.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 | |
tutorial_sdk.spec.EntrypointSpec
Bases: BaseModel
Default runtime entrypoint.
Source code in src/tutorial_sdk/spec.py
110 111 112 113 114 115 116 117 | |
Configuration Loading
tutorial_sdk.config.load_config
load_config(path: str | Path = DEFAULT_CONFIG) -> TutorialSpec
Load a tutorial specification from disk.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
Path to the YAML configuration. |
DEFAULT_CONFIG
|
Returns:
| Type | Description |
|---|---|
TutorialSpec
|
Parsed tutorial specification. |
Source code in src/tutorial_sdk/config.py
11 12 13 14 15 16 17 18 19 20 21 | |
Scaffold & Import
tutorial_sdk.scaffold.templates.ProjectScaffolder
Create starter tutorial projects.
The scaffolder writes a named template directory,
creates a default tutorial YAML configuration file,
and returns a loaded TutorialProject.
Source code in src/tutorial_sdk/scaffold/templates.py
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 | |
scaffold
scaffold(template: str, path: str | Path, name: str | None = None) -> TutorialProject
Create a tutorial project from a template.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
template
|
str
|
Template name (one of
:attr: |
required |
path
|
str | Path
|
Target directory for the project. |
required |
name
|
str | None
|
Optional project name override. Defaults to the directory basename. |
None
|
Returns:
| Type | Description |
|---|---|
TutorialProject
|
A fully initialised |
Raises:
| Type | Description |
|---|---|
ScaffoldError
|
If template is not recognised. |
Source code in src/tutorial_sdk/scaffold/templates.py
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 | |
tutorial_sdk.scaffold.importer.ProjectImporter
Discover and import an existing project as a tutorial.
Importing copies discovered notebooks and related assets into a target directory, detects Python dependencies, and writes a populated tutorial YAML configuration file.
Source code in src/tutorial_sdk/scaffold/importer.py
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 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 | |
scan
scan(source: str | Path, target: str | Path | None = None) -> TutorialProject
Scan source and create a tutorial project at target.
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. Defaults to
|
None
|
Returns:
| Type | Description |
|---|---|
TutorialProject
|
A fully initialised |
Raises:
| Type | Description |
|---|---|
ScaffoldError
|
If source does not exist or contains no notebooks. |
Source code in src/tutorial_sdk/scaffold/importer.py
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 | |
scan_url
scan_url(url: str, target: str | Path | None = None, remove_clone: bool = False) -> TutorialProject
Clone a remote repository and scan it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
url
|
str
|
Git-compatible clone URL. |
required |
target
|
str | Path | None
|
Optional target directory for the project. |
None
|
remove_clone
|
bool
|
If |
False
|
Returns:
| Type | Description |
|---|---|
TutorialProject
|
A |
Source code in src/tutorial_sdk/scaffold/importer.py
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 | |
scan_github
scan_github(org_repo: str, target: str | Path | None = None, remove_clone: bool = False) -> TutorialProject
Import a GitHub repository.
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/scaffold/importer.py
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | |
Generation
tutorial_sdk.generator.dockerfile.DockerfileGenerator
Render Dockerfiles from tutorial specifications.
Source code in src/tutorial_sdk/generator/dockerfile.py
8 9 10 11 12 13 14 15 16 17 18 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 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 | |
__init__
__init__(spec: TutorialSpec, root: str | Path = '.') -> None
Create a Dockerfile generator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spec
|
TutorialSpec
|
Parsed tutorial specification. |
required |
root
|
str | Path
|
Tutorial project root for custom section files. |
'.'
|
Source code in src/tutorial_sdk/generator/dockerfile.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | |
render
render() -> str
Render the Dockerfile text.
Returns:
| Type | Description |
|---|---|
str
|
Complete Dockerfile contents ending with a trailing newline. |
Source code in src/tutorial_sdk/generator/dockerfile.py
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 | |
tutorial_sdk.generator.manifest.ManifestGenerator
Generate machine-readable tutorial manifests.
Source code in src/tutorial_sdk/generator/manifest.py
9 10 11 12 13 14 15 16 17 18 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 | |
__init__
__init__(spec: TutorialSpec) -> None
Create a manifest generator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spec
|
TutorialSpec
|
Parsed tutorial specification. |
required |
Source code in src/tutorial_sdk/generator/manifest.py
12 13 14 15 16 17 18 19 | |
render_dict
render_dict(image: str | None = None) -> dict[str, object]
Render the manifest as a dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image
|
str | None
|
Override image tag. |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, object]
|
Manifest payload dictionary. |
Source code in src/tutorial_sdk/generator/manifest.py
21 22 23 24 25 26 27 28 29 30 31 | |
render_json
render_json(image: str | None = None) -> str
Render the manifest as stable JSON.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image
|
str | None
|
Override image tag. |
None
|
Returns:
| Type | Description |
|---|---|
str
|
Pretty-printed JSON string. |
Source code in src/tutorial_sdk/generator/manifest.py
33 34 35 36 37 38 39 40 41 42 43 | |
write
write(path: str | Path, image: str | None = None) -> None
Write the manifest to disk.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
Destination file path. |
required |
image
|
str | None
|
Override image tag. |
None
|
Source code in src/tutorial_sdk/generator/manifest.py
45 46 47 48 49 50 51 52 53 | |
tutorial_sdk.generator.devcontainer.DevcontainerGenerator
Generate a minimal devcontainer configuration.
Source code in src/tutorial_sdk/generator/devcontainer.py
8 9 10 11 12 13 14 15 16 17 18 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 | |
__init__
__init__(spec: TutorialSpec) -> None
Create a devcontainer generator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spec
|
TutorialSpec
|
Parsed tutorial specification. |
required |
Source code in src/tutorial_sdk/generator/devcontainer.py
11 12 13 14 15 16 17 18 | |
render_dict
render_dict() -> dict[str, object]
Render devcontainer settings.
Returns:
| Type | Description |
|---|---|
dict[str, object]
|
Configuration dictionary. |
Source code in src/tutorial_sdk/generator/devcontainer.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | |
render_json
render_json() -> str
Render devcontainer settings as stable JSON.
Returns:
| Type | Description |
|---|---|
str
|
Pretty-printed JSON string. |
Source code in src/tutorial_sdk/generator/devcontainer.py
37 38 39 40 41 42 43 44 | |
Build & Runtime
tutorial_sdk.builder.docker.BuildResult
dataclass
Result of a container build attempt.
Source code in src/tutorial_sdk/builder/docker.py
11 12 13 14 15 16 17 18 19 | |
tutorial_sdk.builder.docker.DockerBuilder
Build tutorial images with Docker.
Source code in src/tutorial_sdk/builder/docker.py
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 | |
__init__
__init__(spec: TutorialSpec, root: str | Path = '.') -> None
Create a Docker builder.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spec
|
TutorialSpec
|
Parsed tutorial specification. |
required |
root
|
str | Path
|
Tutorial project root directory. |
'.'
|
Source code in src/tutorial_sdk/builder/docker.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 | |
build
build(image: str | None = None, no_cache: bool | None = None, platform: str | None = None) -> BuildResult
Run docker build for the tutorial.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image
|
str | None
|
Override image tag. |
None
|
no_cache
|
bool | None
|
If |
None
|
platform
|
str | None
|
Target platform (e.g.
|
None
|
Returns:
| Type | Description |
|---|---|
BuildResult
|
A |
Raises:
| Type | Description |
|---|---|
BuildError
|
If the build exits non-zero. |
Source code in src/tutorial_sdk/builder/docker.py
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 | |
tutorial_sdk.builder.local.LocalBuilder
Generate local build artifacts before invoking Docker.
Source code in src/tutorial_sdk/builder/local.py
17 18 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 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 | |
__init__
__init__(spec: TutorialSpec, root: str | Path = '.') -> None
Create a local builder.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spec
|
TutorialSpec
|
Parsed tutorial specification. |
required |
root
|
str | Path
|
Tutorial project root directory. |
'.'
|
Source code in src/tutorial_sdk/builder/local.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 | |
write_dockerfile
write_dockerfile(path: str | Path | None = None) -> None
Write the generated Dockerfile.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path | None
|
Destination path. Defaults to the path configured in the build spec. |
None
|
Source code in src/tutorial_sdk/builder/local.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | |
write_manifest
write_manifest(path: str | Path = DEFAULT_MANIFEST_NAME) -> None
Write the tutorial manifest.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
Destination path for the JSON manifest file. |
DEFAULT_MANIFEST_NAME
|
Source code in src/tutorial_sdk/builder/local.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | |
write_devcontainer
write_devcontainer(path: str | Path = DEFAULT_DEVCONT_NAME) -> None
Write devcontainer configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
Destination path for the devcontainer JSON configuration file. |
DEFAULT_DEVCONT_NAME
|
Source code in src/tutorial_sdk/builder/local.py
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | |
prepare
prepare() -> None
Write generated files configured by the tutorial spec.
Source code in src/tutorial_sdk/builder/local.py
87 88 89 90 91 92 93 94 | |
build
build(image: str | None = None, no_cache: bool | None = None, platform: str | None = None) -> BuildResult
Prepare artifacts and run Docker build.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image
|
str | None
|
Override image tag. |
None
|
no_cache
|
bool | None
|
If |
None
|
platform
|
str | None
|
Target platform. |
None
|
Returns:
| Type | Description |
|---|---|
BuildResult
|
A |
Source code in src/tutorial_sdk/builder/local.py
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | |
tutorial_sdk.runtime.launcher.RunResult
dataclass
Result of starting a tutorial runtime.
Source code in src/tutorial_sdk/runtime/launcher.py
10 11 12 13 14 15 16 | |
tutorial_sdk.runtime.launcher.RuntimeLauncher
Launch tutorial images locally with Docker.
Source code in src/tutorial_sdk/runtime/launcher.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 | |
__init__
__init__(spec: TutorialSpec, root: str | Path = '.') -> None
Create a runtime launcher.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spec
|
TutorialSpec
|
Parsed tutorial specification. |
required |
root
|
str | Path
|
Tutorial project root directory. |
'.'
|
Source code in src/tutorial_sdk/runtime/launcher.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 | |
run
run(image: str | None = None, port: int = 8888, shell: bool = False) -> RunResult
Run the configured tutorial image.
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/runtime/launcher.py
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 | |
Validation
tutorial_sdk.validator.report.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 | |
tutorial_sdk.validator.report.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 | |
tutorial_sdk.validator.assets.AssetValidator
Validate declared content assets.
Source code in src/tutorial_sdk/validator/assets.py
9 10 11 12 13 14 15 16 17 18 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 | |
__init__
__init__(spec: TutorialSpec, root: str | Path = '.') -> None
Create an asset validator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spec
|
TutorialSpec
|
Parsed tutorial specification. |
required |
root
|
str | Path
|
Tutorial project root directory. |
'.'
|
Source code in src/tutorial_sdk/validator/assets.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 | |
validate
validate() -> ValidationReport
Check that declared content paths exist.
Returns:
| Type | Description |
|---|---|
ValidationReport
|
A |
Source code in src/tutorial_sdk/validator/assets.py
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 | |
tutorial_sdk.validator.notebooks.NotebookValidator
Validate notebooks declared by a tutorial.
Source code in src/tutorial_sdk/validator/notebooks.py
10 11 12 13 14 15 16 17 18 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 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 | |
__init__
__init__(spec: TutorialSpec, root: str | Path = '.') -> None
Create a notebook validator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spec
|
TutorialSpec
|
Parsed tutorial specification. |
required |
root
|
str | Path
|
Tutorial project root directory. |
'.'
|
Source code in src/tutorial_sdk/validator/notebooks.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 | |
validate
validate() -> ValidationReport
Validate notebook files and stored execution errors.
The MVP does not execute notebooks directly. It detects missing notebook files and error outputs already present in notebooks.
Source code in src/tutorial_sdk/validator/notebooks.py
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 | |
tutorial_sdk.validator.dependencies.DependencyValidator
Validate dependency declarations that can be checked locally.
Source code in src/tutorial_sdk/validator/dependencies.py
9 10 11 12 13 14 15 16 17 18 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 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 | |
__init__
__init__(spec: TutorialSpec) -> None
Create a dependency validator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spec
|
TutorialSpec
|
Parsed tutorial specification. |
required |
Source code in src/tutorial_sdk/validator/dependencies.py
12 13 14 15 16 17 18 19 | |
validate
validate() -> ValidationReport
Validate dependency sections.
Returns:
| Type | Description |
|---|---|
ValidationReport
|
A |
Source code in src/tutorial_sdk/validator/dependencies.py
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 | |
tutorial_sdk.validator.container.ContainerValidator
Validate built container environments.
Source code in src/tutorial_sdk/validator/container.py
12 13 14 15 16 17 18 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 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 | |
__init__
__init__(spec: TutorialSpec, root: str | Path = '.') -> None
Create a container validator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spec
|
TutorialSpec
|
Parsed tutorial specification. |
required |
root
|
str | Path
|
Tutorial project root directory. |
'.'
|
Source code in src/tutorial_sdk/validator/container.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 | |
validate
validate(image: str | None = None) -> ValidationReport
Verify the built container image starts and has JupyterLab.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image
|
str | None
|
Override image tag. Falls back to the build spec's configured image. |
None
|
Returns:
| Type | Description |
|---|---|
ValidationReport
|
A |
Source code in src/tutorial_sdk/validator/container.py
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 | |
Built-in Exceptions
tutorial_sdk.errors
Exception hierarchy for tutorial-sdk.
TutorialSdkError
Bases: Exception
Base class for SDK errors.
Source code in src/tutorial_sdk/errors.py
4 5 | |
ConfigError
Bases: TutorialSdkError
Raised when a tutorial specification is invalid.
Source code in src/tutorial_sdk/errors.py
8 9 | |
BuildError
Bases: TutorialSdkError
Raised when a container build fails.
Source code in src/tutorial_sdk/errors.py
12 13 | |
ValidationError
Bases: TutorialSdkError
Raised when validation cannot complete.
Source code in src/tutorial_sdk/errors.py
16 17 | |
ScaffoldError
Bases: TutorialSdkError
Raised when scaffolding cannot be created.
Source code in src/tutorial_sdk/errors.py
20 21 | |
Extension Protocols
Plugin interfaces for SDK extension points.
ValidatorPlugin
Bases: Protocol
Protocol for external validation plugins.
Source code in src/tutorial_sdk/plugins/__init__.py
6 7 8 9 10 11 12 13 14 15 16 17 18 19 | |
validate
validate(project: object) -> object
Validate a project and return a report.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project
|
object
|
Project-like object supplied by the SDK. |
required |
Returns:
| Type | Description |
|---|---|
object
|
Plugin-defined validation result. |
Source code in src/tutorial_sdk/plugins/__init__.py
11 12 13 14 15 16 17 18 19 | |
TutorialGenerator
Bases: Protocol
Protocol for future tutorial generation strategies.
Source code in src/tutorial_sdk/plugins/__init__.py
22 23 24 25 26 27 28 29 30 31 32 33 | |
generate
generate(request: object) -> object
Generate tutorial content from a request.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
request
|
object
|
Plugin-defined generation request. |
required |
Returns:
| Type | Description |
|---|---|
object
|
Plugin-defined generation result. |
Source code in src/tutorial_sdk/plugins/__init__.py
25 26 27 28 29 30 31 32 33 | |