Replace exec()-based addon loading with manifest-driven loader #248

Closed
opened 2026-02-16 17:12:54 +00:00 by forbes · 0 comments
Owner

Summary

Replace the current exec() calls in src/Mod/Create/Init.py and InitGui.py with a manifest-driven loader that reads each addon's package.xml, validates compatibility and dependencies, and loads addons in dependency order.

Current behavior

The bootstrap module blindly discovers directories under mods/ and calls exec() on their Init.py/InitGui.py. There is no version checking, dependency resolution, or graceful error reporting beyond "submodule absent."

Proposed behavior

  1. On startup, scan mods/ for directories containing package.xml
  2. Parse each manifest into an AddonManifest dataclass (name, version, min Create version, dependencies, registered contexts)
  3. Validate compatibility against the running Create version
  4. Resolve load order from declared dependencies (topological sort)
  5. Skip incompatible or dependency-missing addons with a log warning
  6. Load compatible addons via their Init.py/InitGui.py entry points
  7. Populate an in-memory addon registry accessible to other addons and the bootstrap module

Affected files

  • src/Mod/Create/Init.py — rewrite loader
  • src/Mod/Create/InitGui.py — rewrite GUI loader
  • mods/ztools/package.xml — add/update manifest fields
  • mods/silo/package.xml — add/update manifest fields

Acceptance criteria

  • Addons without valid package.xml are skipped with a warning in the report view
  • Addons declaring a min_create_version higher than current are skipped
  • Addons with missing dependencies are skipped
  • Load order respects dependency declarations (SDK loads before ztools/silo)
  • Existing behavior preserved when all manifests are valid
  • FreeCAD.getAddonRegistry() or equivalent returns loaded addon metadata

Dependencies

None (this is foundational)

Notes

FreeCAD's package.xml already has a schema for addon metadata. Extend it with Kindred-specific fields under a <kindred> element rather than inventing a new file. Fields needed: min_create_version, sdk_version, load_priority, dependencies (list of addon names).

## Summary Replace the current `exec()` calls in `src/Mod/Create/Init.py` and `InitGui.py` with a manifest-driven loader that reads each addon's `package.xml`, validates compatibility and dependencies, and loads addons in dependency order. ## Current behavior The bootstrap module blindly discovers directories under `mods/` and calls `exec()` on their `Init.py`/`InitGui.py`. There is no version checking, dependency resolution, or graceful error reporting beyond "submodule absent." ## Proposed behavior 1. On startup, scan `mods/` for directories containing `package.xml` 2. Parse each manifest into an `AddonManifest` dataclass (name, version, min Create version, dependencies, registered contexts) 3. Validate compatibility against the running Create version 4. Resolve load order from declared dependencies (topological sort) 5. Skip incompatible or dependency-missing addons with a log warning 6. Load compatible addons via their `Init.py`/`InitGui.py` entry points 7. Populate an in-memory addon registry accessible to other addons and the bootstrap module ## Affected files - `src/Mod/Create/Init.py` — rewrite loader - `src/Mod/Create/InitGui.py` — rewrite GUI loader - `mods/ztools/package.xml` — add/update manifest fields - `mods/silo/package.xml` — add/update manifest fields ## Acceptance criteria - [ ] Addons without valid `package.xml` are skipped with a warning in the report view - [ ] Addons declaring a `min_create_version` higher than current are skipped - [ ] Addons with missing dependencies are skipped - [ ] Load order respects dependency declarations (SDK loads before ztools/silo) - [ ] Existing behavior preserved when all manifests are valid - [ ] `FreeCAD.getAddonRegistry()` or equivalent returns loaded addon metadata ## Dependencies None (this is foundational) ## Notes FreeCAD's `package.xml` already has a schema for addon metadata. Extend it with Kindred-specific fields under a `<kindred>` element rather than inventing a new file. Fields needed: `min_create_version`, `sdk_version`, `load_priority`, `dependencies` (list of addon names).
forbes added the enhancement label 2026-02-16 17:12:54 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: kindred/create#248