atlas.core.modules¶
atlas.core.modules
¶
Module lifecycle management — install, remove, update.
resolve_pkg_variables
¶
Replace {{pkg_run}}, {{pkg_add}}, {{pkg_add_dev}},
and {{pkg_sync}} in text with the concrete commands for
package_manager.
Falls back to the pip template when package_manager is unknown.
Unknown placeholder tokens are left unchanged.
Source code in src/atlas/core/modules.py
install_module
¶
install_module(
module_name: str,
registry: dict,
warehouse_dir: str,
atlas_dir: str,
manifest: dict,
package_manager: str = "",
) -> dict
Install a module from the warehouse into the project.
Steps:
1. Validate — exists in registry, not already installed, no conflicts.
2. Load bundle from warehouse (module.json).
3. Scan project config to extract current values.
4. Enrich rules with extracted values.
5. Resolve package manager variables in commands.
6. Write to .atlas/modules/<name>.json.
7. Update manifest in-place.
Returns ok_result(installed=name, warnings=[]) on success,
or an error_result on the first validation failure.
Source code in src/atlas/core/modules.py
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 | |
remove_module
¶
remove_module(
module_name: str,
registry: dict,
atlas_dir: str,
manifest: dict,
config: dict | None = None,
) -> dict
Remove a module from the project.
Steps:
1. Validate — is installed, no other installed module requires it.
2. Scan custom tasks for references to the module (orphan detection).
3. Delete .atlas/modules/<name>.json (if present).
4. Delete .atlas/retrieve/<name>.md (if present).
5. Remove from manifest in-place.
Returns ok_result(removed=name, warnings=[...]) on success —
warnings list contains orphaned task names (if any).
Returns an error_result on validation failure.
Source code in src/atlas/core/modules.py
update_modules
¶
update_modules(
registry: dict,
warehouse_dir: str,
atlas_dir: str,
manifest: dict,
package_manager: str = "",
) -> dict
Re-enrich installed modules whose warehouse version is newer.
For each installed module:
1. Look up the warehouse version from the registry entry.
2. Skip if versions match or warehouse has no version.
3. Re-load bundle, re-scan config, re-enrich, resolve pkg variables.
4. Overwrite .atlas/modules/<name>.json.
5. Update manifest version in-place.
Returns ok_result(updated=[...], skipped=[...]) listing both groups.
Source code in src/atlas/core/modules.py
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 | |