feat(sdk): addon asset path resolution — sdk.addon_resource() #389

Open
opened 2026-03-03 23:03:36 +00:00 by forbes · 0 comments
Owner

Summary

Provide a standard way for addons to locate their bundled assets (icons, translations, data files) without hardcoding paths.

Current state (MISSING)

No addon_resource() or equivalent. Addons use os.path.dirname(__file__) throughout (silo_origin.py, various InitGui.py files). This is fragile and inconsistent between development layouts (source tree) and installed layouts (CMake install prefix).

Proposed API

import kindred_sdk as sdk

icon_path = sdk.addon_resource("silo", "icons/silo_commit.svg")
# -> "/path/to/mods/silo/freecad/icons/silo_commit.svg"
  • Resolves relative to the addon's install root
  • Works for both development (mods/silo/) and installed layouts
  • Raises FileNotFoundError if the resolved path doesn't exist

Implementation notes

  • New module kindred_sdk/assets.py
  • Looks up addon install root from AddonRegistry.get(name).path
  • Simple os.path.join(root, relative_path) with existence check
  • Export addon_resource from kindred_sdk.__init__

Roadmap

v0.2.0 — Addon Loader

## Summary Provide a standard way for addons to locate their bundled assets (icons, translations, data files) without hardcoding paths. ## Current state (MISSING) No `addon_resource()` or equivalent. Addons use `os.path.dirname(__file__)` throughout (`silo_origin.py`, various `InitGui.py` files). This is fragile and inconsistent between development layouts (source tree) and installed layouts (CMake install prefix). ## Proposed API ```python import kindred_sdk as sdk icon_path = sdk.addon_resource("silo", "icons/silo_commit.svg") # -> "/path/to/mods/silo/freecad/icons/silo_commit.svg" ``` - Resolves relative to the addon's install root - Works for both development (`mods/silo/`) and installed layouts - Raises `FileNotFoundError` if the resolved path doesn't exist ## Implementation notes - New module `kindred_sdk/assets.py` - Looks up addon install root from `AddonRegistry.get(name).path` - Simple `os.path.join(root, relative_path)` with existence check - Export `addon_resource` from `kindred_sdk.__init__` ## Roadmap v0.2.0 — Addon Loader
forbes added the enhancement label 2026-03-03 23:03:36 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: kindred/create#389