Component: SmrtSpace Management¶
Canonical source:
SmrtApps/PythonApp/python_core/smrtspace_mgt/README.md(mirrored below)
python_core.smrtspace_mgt¶
Overview¶
- Location:
SmrtApps/PythonApp/python_core/smrtspace_mgt - Purpose: Create, persist, and inject SmrtSpace metadata and configuration for Python Core startup.
Responsibilities¶
- Persist the active SmrtSpace name/root under
%AppData%/SmrtHub/Config/smrt-space/active_smrtspace.json. - Load SmrtSpace metadata only when an explicit selection exists (no auto-creation).
- Normalize user supplied paths before they are saved or injected.
- Load SmrtSpace scoped configuration and merge it into runtime
user_flagswith guard rails. - Emit operational logs through
python_core.utils.logger.get_logger_for("smrtspace")only; emojis remain in terminal streams but not in persisted logs.
Runtime Flow¶
initialize_smrtspace_system()(exported from__init__.py) checks for an active selection and injects config only when available.- Metadata helpers (
load_smrtspace_meta,save_smrtspace_meta,get_smrtspace_root,get_smrtspace_name,try_get_smrtspace_selection) provide the persisted context to any caller. inject_smrtspace_config()loads SmrtSpace configuration and applies values to knownuser_flagskeys while logging mismatches.get_config_bridge_status()surfaces diagnostics for telemetry and support tooling.
Key Functions¶
try_get_smrtspace_selection()— returns the active selection orNonewhen no SmrtSpace is set.ensure_smrtspace_initialized()— interactive helper used only for explicit creation flows (not invoked on startup).save_smrtspace_meta(name, root)— writes metadata using an atomic temp-file swap and records the action to the smrtspace log._generate_unique_smrtspace_name()— produces the defaultNewSmrtSpacename with numeric suffixes if folders already exist._optional_dir_input(...)— shared prompt handler for collecting additional include/exclude directories._normalize_path(path_str)— converts user input into absolute paths, returning""when normalization fails.inject_smrtspace_config()— applies SmrtSpace overrides only for keys already present inuser_flags; skips unknown keys and logs type mismatches.get_config_bridge_status()— returns a dictionary with version info, supported flag counts, and whether a SmrtSpace config file was available.
Operational Notes¶
- All filesystem access respects the Operational Data Policy; do not add new locations without architecture approval.
- The configuration bridge is intended for single-threaded initialization; invoke it before background workers spawn.
- SmrtSpace creation is explicit and UI-driven; Python core never auto-creates default SmrtSpaces on startup.
- Consumers should treat README as the canonical documentation; inline docstrings intentionally remain concise.
- Errors are logged and surfaced to support bundles; callers should not suppress the logger output.
Related Docs¶
README.Files/System/Policies/SmrtHub-Operational-Data-Policy-v1.0.README.mdREADME.Files/Reference-Guides/SmrtHub.Logging.README.mdSmrtApps/PythonApp/python_core/README.md