Client module for recipe operations.
DiscoveryClient
¶
Client for discovering available recipes.
Source code in src/nskit/client/discovery.py
__init__(backend)
¶
Initialize discovery client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
backend
|
RecipeBackend
|
Backend for recipe discovery |
required |
discover_recipes(search_term=None)
¶
Discover available recipes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
search_term
|
Optional[str]
|
Optional search term to filter recipes |
None
|
Returns:
| Type | Description |
|---|---|
list[RecipeInfo]
|
List of discovered recipes |
Source code in src/nskit/client/discovery.py
get_recipe_info(recipe_name)
¶
Get detailed info for a specific recipe.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
recipe_name
|
str
|
Recipe name |
required |
Returns:
| Type | Description |
|---|---|
Optional[RecipeInfo]
|
Recipe info or None if not found |
Source code in src/nskit/client/discovery.py
get_recipe_versions(recipe_name)
¶
Get available versions for a recipe.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
recipe_name
|
str
|
Recipe name |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
List of available versions |
DockerEngine
¶
Bases: RecipeEngine
Execute recipes in Docker containers.
Source code in src/nskit/client/engines/docker.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 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 | |
__init__(skip_pull=False, timeouts=None)
¶
Initialise the Docker engine.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
skip_pull
|
bool
|
Skip pulling the image (useful for locally built images). |
False
|
timeouts
|
EngineTimeouts | dict | None
|
Timeout configuration for Docker operations. |
None
|
Source code in src/nskit/client/engines/docker.py
execute(recipe, version, parameters, output_dir, image_url=None, entrypoint=None)
¶
Execute recipe in a Docker container.
Writes parameters to a YAML file, mounts it into the container,
and invokes the nskit CLI init command.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
recipe
|
str
|
Recipe name. |
required |
version
|
str
|
Recipe version. |
required |
parameters
|
dict[str, Any]
|
Recipe input parameters. |
required |
output_dir
|
Path
|
Host directory for generated output. |
required |
image_url
|
str | None
|
Docker image URL (required). |
None
|
entrypoint
|
str | None
|
Not used for Docker engine. |
None
|
Returns:
| Type | Description |
|---|---|
RecipeResult
|
Recipe execution result. |
Source code in src/nskit/client/engines/docker.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 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | |
LocalEngine
¶
Bases: RecipeEngine
Execute recipes from locally installed packages.
Source code in src/nskit/client/engines/local.py
execute(recipe, version, parameters, output_dir, image_url=None, entrypoint=None)
¶
Execute recipe from installed package.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
recipe
|
str
|
Recipe name. |
required |
version
|
str
|
Recipe version. |
required |
parameters
|
dict[str, Any]
|
Recipe parameters. |
required |
output_dir
|
Path
|
Output directory. |
required |
image_url
|
str
|
Not used for Local engine. |
None
|
entrypoint
|
str
|
Recipe entrypoint (required). |
None
|
Returns:
| Type | Description |
|---|---|
RecipeResult
|
Recipe execution result. |
Source code in src/nskit/client/engines/local.py
RecipeClient
¶
Pure Python client for recipe operations (no CLI dependencies).
Source code in src/nskit/client/recipes.py
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 | |
__init__(backend, engine=None)
¶
Initialize the recipe client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
backend
|
RecipeBackend
|
Backend for recipe discovery and fetching |
required |
engine
|
RecipeEngine | None
|
Execution engine (defaults to DockerEngine) |
None
|
Source code in src/nskit/client/recipes.py
create_repository(repo_name, project_path=None, description=None, private=True)
¶
Create a remote repository and optionally push the project.
Auto-detects the VCS provider from environment variables. If project_path is provided and contains a git repo, the project is committed and pushed to the new remote.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
repo_name
|
str
|
Repository name. |
required |
project_path
|
Path | None
|
Local project directory to push. |
None
|
description
|
str | None
|
Repository description. |
None
|
private
|
bool
|
Whether the repository should be private. |
True
|
Returns:
| Type | Description |
|---|---|
tuple[bool, str]
|
Tuple of (success, message). |
Source code in src/nskit/client/recipes.py
get_recipe_versions(recipe)
¶
Get available versions for a specific recipe.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
recipe
|
str
|
Recipe name |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
List of available versions |
initialize_recipe(recipe, version, parameters, output_dir, force=False)
¶
Initialize a new project from a recipe.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
recipe
|
str
|
Recipe name |
required |
version
|
str
|
Recipe version |
required |
parameters
|
dict[str, Any]
|
Recipe parameters |
required |
output_dir
|
Path
|
Output directory for the project |
required |
force
|
bool
|
Allow initialization in non-empty directory |
False
|
Returns:
| Type | Description |
|---|---|
RecipeResult
|
Result of the initialization |
Source code in src/nskit/client/recipes.py
list_recipes()
¶
List all available recipes from the backend.
Returns:
| Type | Description |
|---|---|
list[RecipeInfo]
|
List of recipe information |
RecipeEngine
¶
Bases: ABC
Abstract interface for recipe execution engines.
Source code in src/nskit/client/engines/base.py
execute(recipe, version, parameters, output_dir, image_url=None, entrypoint=None)
abstractmethod
¶
Execute a recipe.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
recipe
|
str
|
Recipe name |
required |
version
|
str
|
Recipe version |
required |
parameters
|
dict[str, Any]
|
Recipe parameters |
required |
output_dir
|
Path
|
Output directory |
required |
image_url
|
str
|
Docker image URL (for Docker engine) |
None
|
entrypoint
|
str
|
Recipe entrypoint (for Local engine) |
None
|
Returns:
| Type | Description |
|---|---|
RecipeResult
|
Recipe execution result |
Source code in src/nskit/client/engines/base.py
RecipeInfo
¶
RecipeResult
¶
Bases: BaseModel
Result of recipe initialization.
Source code in src/nskit/client/models.py
UpdateClient
¶
Pure Python client for recipe updates (no CLI dependencies).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
backend
|
RecipeBackend
|
Backend for fetching recipe versions. |
required |
engine
|
RecipeEngine | None
|
Optional recipe engine for project generation. |
None
|
config_dir
|
str
|
Config directory name (default |
'.recipe'
|
config_filename
|
str
|
Config file name (default |
'config.yml'
|
Source code in src/nskit/client/update.py
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 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 | |
check_update_available(project_path)
¶
Check if an update is available for the project.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project_path
|
Path
|
Path to the project. |
required |
Returns:
| Type | Description |
|---|---|
str | None
|
Latest version string if an update is available, |
str | None
|
otherwise. |
Source code in src/nskit/client/update.py
update_project(project_path, target_version, diff_mode=DiffMode.THREE_WAY, dry_run=False)
¶
Update project to target version.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project_path
|
Path
|
Path to the project. |
required |
target_version
|
str
|
Target version to update to. |
required |
diff_mode
|
DiffMode
|
Diff mode (2-way or 3-way). |
THREE_WAY
|
dry_run
|
bool
|
If |
False
|
Returns:
| Type | Description |
|---|---|
UpdateResult
|
Update result with conflicts and errors. |
Source code in src/nskit/client/update.py
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 | |
UpdateResult
¶
Bases: BaseModel
Result of recipe update.
Source code in src/nskit/client/models.py
nskit.client.recipes.RecipeClient
¶
Pure Python client for recipe operations (no CLI dependencies).
Source code in src/nskit/client/recipes.py
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 | |
list_recipes()
¶
List all available recipes from the backend.
Returns:
| Type | Description |
|---|---|
list[RecipeInfo]
|
List of recipe information |
get_recipe_versions(recipe)
¶
Get available versions for a specific recipe.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
recipe
|
str
|
Recipe name |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
List of available versions |
initialize_recipe(recipe, version, parameters, output_dir, force=False)
¶
Initialize a new project from a recipe.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
recipe
|
str
|
Recipe name |
required |
version
|
str
|
Recipe version |
required |
parameters
|
dict[str, Any]
|
Recipe parameters |
required |
output_dir
|
Path
|
Output directory for the project |
required |
force
|
bool
|
Allow initialization in non-empty directory |
False
|
Returns:
| Type | Description |
|---|---|
RecipeResult
|
Result of the initialization |
Source code in src/nskit/client/recipes.py
nskit.client.update.UpdateClient
¶
Pure Python client for recipe updates (no CLI dependencies).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
backend
|
RecipeBackend
|
Backend for fetching recipe versions. |
required |
engine
|
RecipeEngine | None
|
Optional recipe engine for project generation. |
None
|
config_dir
|
str
|
Config directory name (default |
'.recipe'
|
config_filename
|
str
|
Config file name (default |
'config.yml'
|
Source code in src/nskit/client/update.py
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 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 | |
check_update_available(project_path)
¶
Check if an update is available for the project.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project_path
|
Path
|
Path to the project. |
required |
Returns:
| Type | Description |
|---|---|
str | None
|
Latest version string if an update is available, |
str | None
|
otherwise. |
Source code in src/nskit/client/update.py
update_project(project_path, target_version, diff_mode=DiffMode.THREE_WAY, dry_run=False)
¶
Update project to target version.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project_path
|
Path
|
Path to the project. |
required |
target_version
|
str
|
Target version to update to. |
required |
diff_mode
|
DiffMode
|
Diff mode (2-way or 3-way). |
THREE_WAY
|
dry_run
|
bool
|
If |
False
|
Returns:
| Type | Description |
|---|---|
UpdateResult
|
Update result with conflicts and errors. |
Source code in src/nskit/client/update.py
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 | |
nskit.client.discovery.DiscoveryClient
¶
Client for discovering available recipes.
Source code in src/nskit/client/discovery.py
discover_recipes(search_term=None)
¶
Discover available recipes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
search_term
|
Optional[str]
|
Optional search term to filter recipes |
None
|
Returns:
| Type | Description |
|---|---|
list[RecipeInfo]
|
List of discovered recipes |
Source code in src/nskit/client/discovery.py
get_recipe_info(recipe_name)
¶
Get detailed info for a specific recipe.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
recipe_name
|
str
|
Recipe name |
required |
Returns:
| Type | Description |
|---|---|
Optional[RecipeInfo]
|
Recipe info or None if not found |
Source code in src/nskit/client/discovery.py
get_recipe_versions(recipe_name)
¶
Get available versions for a recipe.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
recipe_name
|
str
|
Recipe name |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
List of available versions |
Engines¶
nskit.client.engines.base.RecipeEngine
¶
Bases: ABC
Abstract interface for recipe execution engines.
Source code in src/nskit/client/engines/base.py
execute(recipe, version, parameters, output_dir, image_url=None, entrypoint=None)
abstractmethod
¶
Execute a recipe.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
recipe
|
str
|
Recipe name |
required |
version
|
str
|
Recipe version |
required |
parameters
|
dict[str, Any]
|
Recipe parameters |
required |
output_dir
|
Path
|
Output directory |
required |
image_url
|
str
|
Docker image URL (for Docker engine) |
None
|
entrypoint
|
str
|
Recipe entrypoint (for Local engine) |
None
|
Returns:
| Type | Description |
|---|---|
RecipeResult
|
Recipe execution result |
Source code in src/nskit/client/engines/base.py
nskit.client.engines.local.LocalEngine
¶
Bases: RecipeEngine
Execute recipes from locally installed packages.
Source code in src/nskit/client/engines/local.py
execute(recipe, version, parameters, output_dir, image_url=None, entrypoint=None)
¶
Execute recipe from installed package.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
recipe
|
str
|
Recipe name. |
required |
version
|
str
|
Recipe version. |
required |
parameters
|
dict[str, Any]
|
Recipe parameters. |
required |
output_dir
|
Path
|
Output directory. |
required |
image_url
|
str
|
Not used for Local engine. |
None
|
entrypoint
|
str
|
Recipe entrypoint (required). |
None
|
Returns:
| Type | Description |
|---|---|
RecipeResult
|
Recipe execution result. |
Source code in src/nskit/client/engines/local.py
nskit.client.engines.docker.DockerEngine
¶
Bases: RecipeEngine
Execute recipes in Docker containers.
Source code in src/nskit/client/engines/docker.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 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 | |
__init__(skip_pull=False, timeouts=None)
¶
Initialise the Docker engine.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
skip_pull
|
bool
|
Skip pulling the image (useful for locally built images). |
False
|
timeouts
|
EngineTimeouts | dict | None
|
Timeout configuration for Docker operations. |
None
|
Source code in src/nskit/client/engines/docker.py
execute(recipe, version, parameters, output_dir, image_url=None, entrypoint=None)
¶
Execute recipe in a Docker container.
Writes parameters to a YAML file, mounts it into the container,
and invokes the nskit CLI init command.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
recipe
|
str
|
Recipe name. |
required |
version
|
str
|
Recipe version. |
required |
parameters
|
dict[str, Any]
|
Recipe input parameters. |
required |
output_dir
|
Path
|
Host directory for generated output. |
required |
image_url
|
str | None
|
Docker image URL (required). |
None
|
entrypoint
|
str | None
|
Not used for Docker engine. |
None
|
Returns:
| Type | Description |
|---|---|
RecipeResult
|
Recipe execution result. |
Source code in src/nskit/client/engines/docker.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 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | |
Backends¶
nskit.client.backends.base.RecipeBackend
¶
Bases: ABC
Abstract interface for recipe backends.
Source code in src/nskit/client/backends/base.py
entrypoint
abstractmethod
property
¶
Get the recipe entrypoint for this backend.
fetch_recipe(recipe, version, dest)
abstractmethod
¶
Fetch a recipe to a destination directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
recipe
|
str
|
Recipe name. |
required |
version
|
str
|
Recipe version. |
required |
dest
|
Path
|
Destination directory. |
required |
Returns:
| Type | Description |
|---|---|
Path
|
Path to the fetched recipe. |
Source code in src/nskit/client/backends/base.py
get_image_url(recipe, version)
¶
Get Docker image URL for a recipe.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
recipe
|
str
|
Recipe name. |
required |
version
|
str
|
Recipe version. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Docker image URL. |
Source code in src/nskit/client/backends/base.py
get_recipe_metadata(recipe, version)
¶
Get metadata for a specific recipe version.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
recipe
|
str
|
Recipe name. |
required |
version
|
str
|
Recipe version. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Recipe metadata dictionary. |
Source code in src/nskit/client/backends/base.py
get_recipe_versions(recipe)
abstractmethod
¶
Get available versions for a recipe.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
recipe
|
str
|
Recipe name. |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
List of version strings. |
list_recipes()
abstractmethod
¶
pull_image(image_url)
¶
Pull Docker image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image_url
|
str
|
Docker image URL to pull. |
required |
nskit.client.backends.local.LocalBackend
¶
Bases: RecipeBackend
Backend for local filesystem recipes.
Source code in src/nskit/client/backends/local.py
entrypoint
property
¶
Get the recipe entrypoint.
__init__(recipes_dir, entrypoint=RECIPE_ENTRYPOINT)
¶
Initialize local backend.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
recipes_dir
|
Path
|
Directory containing recipes. |
required |
entrypoint
|
str
|
Recipe entrypoint name. |
RECIPE_ENTRYPOINT
|
Source code in src/nskit/client/backends/local.py
fetch_recipe(recipe, version, dest)
¶
Copy recipe from local directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
recipe
|
str
|
Recipe name. |
required |
version
|
str
|
Recipe version. |
required |
dest
|
Path
|
Destination directory. |
required |
Returns:
| Type | Description |
|---|---|
Path
|
Path to the copied recipe. |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If the recipe version does not exist. |
Source code in src/nskit/client/backends/local.py
get_recipe_versions(recipe)
¶
Get versions for a recipe.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
recipe
|
str
|
Recipe name. |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
Sorted list of version strings. |
Source code in src/nskit/client/backends/local.py
list_recipes()
¶
List recipes from local directory.
Returns:
| Type | Description |
|---|---|
list[RecipeInfo]
|
List of recipe information found in the recipes directory. |
Source code in src/nskit/client/backends/local.py
nskit.client.backends.github.GitHubBackend
¶
Bases: RecipeBackend
Backend that fetches recipes from GitHub releases.
Source code in src/nskit/client/backends/github.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 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 | |
entrypoint
property
¶
Get the recipe entrypoint.
__init__(org, repo_pattern='{recipe_name}', token=None, entrypoint=RECIPE_ENTRYPOINT)
¶
Initialize GitHub backend.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
org
|
str
|
GitHub organization. |
required |
repo_pattern
|
str
|
Pattern for repository names (use {recipe_name} placeholder). |
'{recipe_name}'
|
token
|
str | SecretStr | None
|
Optional GitHub token (str or SecretStr; uses gh CLI if not provided). |
None
|
entrypoint
|
str
|
Recipe entrypoint name. |
RECIPE_ENTRYPOINT
|
Source code in src/nskit/client/backends/github.py
fetch_recipe(recipe_name, version, target_path)
¶
Fetch recipe from GitHub release.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
recipe_name
|
str
|
Recipe name. |
required |
version
|
str
|
Recipe version (tag name). |
required |
target_path
|
Path
|
Where to extract recipe. |
required |
Returns:
| Type | Description |
|---|---|
Path
|
Path to extracted recipe. |
Source code in src/nskit/client/backends/github.py
get_image_url(recipe, version)
¶
Get Docker image URL from GitHub Container Registry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
recipe
|
str
|
Recipe name. |
required |
version
|
str
|
Recipe version. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Docker image URL. |
Source code in src/nskit/client/backends/github.py
get_recipe_versions(recipe_name)
¶
Get available versions for a recipe.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
recipe_name
|
str
|
Recipe name. |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
List of version tag strings. |
Source code in src/nskit/client/backends/github.py
list_recipes()
¶
List available recipes from GitHub org.
Returns:
| Type | Description |
|---|---|
list[RecipeInfo]
|
List of recipe information from the organization's repositories. |
Source code in src/nskit/client/backends/github.py
pull_image(image_url)
¶
Pull Docker image from GitHub Container Registry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image_url
|
str
|
Docker image URL to pull. |
required |
Source code in src/nskit/client/backends/github.py
nskit.client.backends.docker.DockerBackend
¶
Bases: RecipeBackend
Backend that fetches recipes from Docker registry.
Source code in src/nskit/client/backends/docker.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 | |
entrypoint
property
¶
Get the recipe entrypoint.
__init__(registry_url='ghcr.io', image_prefix='', auth_token=None, entrypoint=RECIPE_ENTRYPOINT, timeouts=None)
¶
Initialize Docker backend.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
registry_url
|
str
|
Docker registry URL (e.g., ghcr.io). |
'ghcr.io'
|
image_prefix
|
str
|
Prefix for image names (e.g., org/project). |
''
|
auth_token
|
str | SecretStr | None
|
Optional authentication token (str or SecretStr). |
None
|
entrypoint
|
str
|
Recipe entrypoint name. |
RECIPE_ENTRYPOINT
|
timeouts
|
DockerTimeouts | None
|
Timeout configuration for Docker operations. |
None
|
Source code in src/nskit/client/backends/docker.py
fetch_recipe(recipe_name, version, target_path)
¶
Fetch recipe from Docker image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
recipe_name
|
str
|
Recipe name. |
required |
version
|
str
|
Recipe version. |
required |
target_path
|
Path
|
Where to extract recipe. |
required |
Returns:
| Type | Description |
|---|---|
Path
|
Path to extracted recipe. |
Source code in src/nskit/client/backends/docker.py
get_image_url(recipe, version)
¶
Get Docker image URL for a recipe.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
recipe
|
str
|
Recipe name. |
required |
version
|
str
|
Recipe version. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Docker image URL. |
Source code in src/nskit/client/backends/docker.py
get_recipe_versions(recipe_name)
¶
Get available versions for a recipe.
Note: Requires external API or manifest inspection. Returns empty list as Docker doesn't provide easy version listing.
Source code in src/nskit/client/backends/docker.py
list_recipes()
¶
List available recipes.
Note: Docker registries don't provide easy listing. This is a limitation of the Docker backend.
pull_image(image_url)
¶
Pull Docker image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image_url
|
str
|
Docker image URL to pull. |
required |
Source code in src/nskit/client/backends/docker.py
nskit.client.backends.docker_local.DockerLocalBackend
¶
Bases: RecipeBackend
Backend that discovers recipes from locally available Docker images.
Filters images by the nskit.recipe=true label. Each image must
also have nskit.recipe.name set. Versions are derived from image
tags.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entrypoint
|
str
|
Recipe entry point group name. |
RECIPE_ENTRYPOINT
|
label_filter
|
str
|
Label to filter images (default |
f'{LABEL_PREFIX}=true'
|
Source code in src/nskit/client/backends/docker_local.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 | |
entrypoint
property
¶
Get the recipe entrypoint.
fetch_recipe(recipe, version, dest)
¶
Not used — Docker images are executed directly.
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
Always. |
Source code in src/nskit/client/backends/docker_local.py
get_image_url(recipe, version)
¶
Get the full image:tag for a recipe version.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
recipe
|
str
|
Recipe name. |
required |
version
|
str
|
Recipe version. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Full image reference string. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If no matching local image is found. |
Source code in src/nskit/client/backends/docker_local.py
get_recipe_versions(recipe)
¶
Get versions for a recipe from local image tags.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
recipe
|
str
|
Recipe name. |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
Sorted list of version strings (newest first). |
Source code in src/nskit/client/backends/docker_local.py
list_recipes()
¶
List recipes from locally pulled Docker images.
Returns:
| Type | Description |
|---|---|
list[RecipeInfo]
|
List of recipe information from local images. |
Source code in src/nskit/client/backends/docker_local.py
Models¶
nskit.client.models.RecipeResult
¶
Bases: BaseModel
Result of recipe initialization.
Source code in src/nskit/client/models.py
nskit.client.models.UpdateResult
¶
Bases: BaseModel
Result of recipe update.
Source code in src/nskit/client/models.py
nskit.client.models.RecipeInfo
¶
Configuration¶
nskit.client.config.ConfigManager
¶
Manages recipe configuration files.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project_path
|
Path
|
Root path of the project. |
required |
config_dir
|
str
|
Directory name for config storage (default |
'.recipe'
|
config_filename
|
str
|
Config file name (default |
'config.yml'
|
Source code in src/nskit/client/config.py
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 | |
is_recipe_based()
¶
Check whether the project has a recipe configuration file.
Returns:
| Type | Description |
|---|---|
bool
|
|
load_config()
¶
Load recipe configuration from YAML.
Returns:
| Type | Description |
|---|---|
RecipeConfig
|
Parsed |
Raises:
| Type | Description |
|---|---|
ProjectNotRecipeBasedError
|
If the config file does not exist. |
InvalidConfigError
|
If the YAML is invalid or cannot be parsed. |
Source code in src/nskit/client/config.py
save_config(config)
¶
Save recipe configuration to YAML.
Creates the config directory if it does not exist. Serialises datetime fields to ISO format strings.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
RecipeConfig
|
Configuration to persist. |
required |
Source code in src/nskit/client/config.py
update_config_version(new_version, recipe_name)
¶
Update the Docker image version and timestamp in the config.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
new_version
|
str
|
New version tag to set. |
required |
recipe_name
|
str
|
Recipe name (used if metadata is missing). |
required |
Source code in src/nskit/client/config.py
nskit.client.config.RecipeConfig
¶
Bases: BaseModel
Recipe configuration persisted in a project.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input
|
Original input parameters used for generation. |
required | |
rendered
|
Rendered/resolved parameter values. |
required | |
metadata
|
Recipe metadata (name, image, timestamps). |
required |
Source code in src/nskit/client/config.py
Exceptions¶
nskit.client.exceptions
¶
Domain-specific exceptions for nskit client operations.
ConfigNotFoundError
¶
Bases: Exception
Raised when the recipe configuration file does not exist.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config_path
|
str
|
Expected path to the configuration file. |
required |
Source code in src/nskit/client/exceptions.py
FileSystemError
¶
Bases: Exception
Raised when a file system operation fails.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
operation
|
str
|
Name of the operation that failed. |
required |
path
|
str
|
Path of the file involved. |
required |
reason
|
str
|
Description of why the operation failed. |
required |
Source code in src/nskit/client/exceptions.py
__str__()
¶
GitStatusError
¶
Bases: Exception
Raised when the Git repository is not in a ready state.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
reason
|
str
|
Description of why the repository is not ready. |
required |
Source code in src/nskit/client/exceptions.py
InitError
¶
Bases: Exception
Raised when recipe initialisation fails.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
str
|
Description of the initialisation failure. |
required |
details
|
str | None
|
Optional additional details about the failure. |
None
|
Source code in src/nskit/client/exceptions.py
InvalidConfigError
¶
Bases: Exception
Raised when a recipe configuration file contains invalid content.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
errors
|
list[str]
|
List of validation error descriptions. |
required |
Source code in src/nskit/client/exceptions.py
__str__()
¶
Format the error message with a bulleted list of errors.
ProjectNotRecipeBasedError
¶
Bases: Exception
Raised when a project does not have a recipe configuration file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project_path
|
str
|
Path to the project directory. |
required |
Source code in src/nskit/client/exceptions.py
__str__()
¶
Format the error message with project path and guidance.
UpdateError
¶
Bases: Exception
Raised when a recipe update operation fails.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
str
|
Description of the update failure. |
required |
details
|
str | None
|
Optional additional details about the failure. |
None
|