feat(sdk): per-document origin Python bindings #391

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

Summary

Expose the existing C++ per-document origin tracking through the Python SDK so addons can query and set origins per document.

Current state (PARTIAL)

C++ side is fully implemented in OriginManager:

  • setDocumentOrigin(App::Document*, FileOrigin*)
  • originForDocument(App::Document*)
  • findOwningOrigin(App::Document*)
  • clearDocumentOrigin(App::Document*)
  • signalDocumentOriginChanged

Python SDK (kindred_sdk/origin.py) only exposes global origin queries:

  • active_origin(), set_active_origin(), get_origin(), list_origins()
  • No document_origin(doc) or set_document_origin(doc, origin_id)

Proposed API

import kindred_sdk as sdk

origin = sdk.document_origin(doc)            # -> origin info dict or None
sdk.set_document_origin(doc, "silo")         # explicit association

Enables mixed workflows where some tabs are local and others are Silo-tracked.

Implementation notes

  • Add kcsdk pybind11 bindings for OriginManager::originForDocument() and setDocumentOrigin()
  • Add document_origin(), set_document_origin() to kindred_sdk/origin.py
  • Accept either App.Document object or document name string

Roadmap

v0.2.0 — Origin System

## Summary Expose the existing C++ per-document origin tracking through the Python SDK so addons can query and set origins per document. ## Current state (PARTIAL) C++ side is fully implemented in `OriginManager`: - `setDocumentOrigin(App::Document*, FileOrigin*)` - `originForDocument(App::Document*)` - `findOwningOrigin(App::Document*)` - `clearDocumentOrigin(App::Document*)` - `signalDocumentOriginChanged` Python SDK (`kindred_sdk/origin.py`) only exposes global origin queries: - `active_origin()`, `set_active_origin()`, `get_origin()`, `list_origins()` - No `document_origin(doc)` or `set_document_origin(doc, origin_id)` ## Proposed API ```python import kindred_sdk as sdk origin = sdk.document_origin(doc) # -> origin info dict or None sdk.set_document_origin(doc, "silo") # explicit association ``` Enables mixed workflows where some tabs are local and others are Silo-tracked. ## Implementation notes - Add kcsdk pybind11 bindings for `OriginManager::originForDocument()` and `setDocumentOrigin()` - Add `document_origin()`, `set_document_origin()` to `kindred_sdk/origin.py` - Accept either `App.Document` object or document name string ## Roadmap v0.2.0 — Origin System
forbes added the enhancement label 2026-03-03 23:04:03 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: kindred/create#391