Configuration Utilities¶
Canonical helpers for loading, normalizing, and persisting SmrtHub Python configuration so it aligns with Smrt.Config.
python_core.config.smrtdetect_indexer_settings¶
SmrtDetect indexer settings for python_core.
This module owns the global (non-SmrtSpace-scoped) runtime settings for the SmrtDetect file indexer, such as refresh scheduling and filesystem watcher enablement.
Search locations are configured separately via the SmrtDetect
search-locations.json contract.
load_indexer_settings ¶
Load SmrtDetect indexer settings, returning defaults when absent.
:return: Indexer settings with missing fields filled from defaults. :rtype: dict[str, Any]
load_or_seed_indexer_settings ¶
Return SmrtDetect indexer settings, seeding defaults when necessary.
The helper reads %APPDATA%/SmrtHub/Config/smrt-detect/indexer-settings.json.
When the file is absent it seeds from defaults/indexer-settings.defaults.json
and validates against schema/indexer-settings.schema.json when jsonschema
is installed.
:return: Indexer settings configuration dictionary. :rtype: dict[str, Any]
save_indexer_settings ¶
Persist updated indexer settings to disk.
:param updated_settings: Settings payload to write.
update_indexer_settings ¶
Persist a single setting update.
:param key: Setting key to update. :param value: New value written for the key.
python_core.config.smrtspace_config¶
SmrtSpace configuration helpers for python_core.
Per-SmrtSpace configuration lives under the user-scoped Operational Data Policy root:
%APPDATA%/SmrtHub/Config/smrt-space/<SmrtSpace>/smrtspace-config.json
The active SmrtSpace selection (name + root) is also user-scoped so multiple Windows user accounts on the same machine remain compartmentalized:
%APPDATA%/SmrtHub/Config/smrt-space/active_smrtspace.json
See Also
SmrtApps/PythonApp/python_core/config/README.md
ensure_smrtspace_dir ¶
Ensure the active SmrtSpace configuration directory exists.
:returns: True when a directory was ensured; otherwise False.
get_smrtspace_config_path ¶
Return the canonical config path for the active SmrtSpace.
get_smrtspace_name ¶
Return the active SmrtSpace name from user-scoped metadata.
:returns: SmrtSpace name when available; otherwise None.
load_smrtspace_config ¶
Load the active SmrtSpace configuration when available.
:return: Configuration dictionary merged with defaults, or None when no
active SmrtSpace is selected.
:rtype: dict[str, Any] | None
save_smrtspace_config ¶
Persist the active SmrtSpace configuration after normalising path lists.
:param updated_config: Configuration payload to store for the active workspace.
update_smrtspace_config ¶
Apply and persist a single SmrtSpace configuration change.
:param key: Configuration key to update. :param value: New value written for the key.
python_core.config.localsource_exclusions¶
Local-source exclusion defaults and helpers for python_core.
The module exposes load_local_exclusions which returns the canonical
exclusion payload stored under the smrt-detect slug defined by the
Operational Data Policy.
Exclusion Framework¶
This module provides both configuration loading and runtime checking helpers:
load_local_exclusions()— Returns the exclusion config from disk or defaultsis_excluded_app(name)— Check if an app name should be excluded from source trackingis_excluded_window(title)— Check if a window title contains blacklisted keywords
The exclusion helpers are used by localsource.py to prevent system apps,
dev tools, and SmrtHub's own components from being tracked as clipboard sources.
See Also
SmrtApps/PythonApp/python_core/config/README.md SmrtApps/PythonApp/python_core/smrtdetect/README.md
clear_exclusion_cache ¶
Clear the cached exclusion sets.
Call this after modifying the exclusion config file to force a reload on the next exclusion check. Primarily useful for testing.
is_excluded_app ¶
Check if an application name is on the exclusion list.
Performs case-insensitive matching against the configured excluded_app_names.
Use this before committing source data to shared state to prevent system apps,
dev tools, and SmrtHub's own components from appearing as clipboard sources.
:param app_name: Application name or filename to check (e.g., "PythonApp.exe").
:returns: True if the app should be excluded from source tracking.
Example¶
is_excluded_app("PythonApp.exe") True is_excluded_app("notepad.exe") False is_excluded_app(None) False
is_excluded_window ¶
Check if a window title contains any blacklisted keywords.
Performs case-insensitive substring matching against the configured
blacklisted_window_keywords. Use this as an additional filter when
app name exclusion isn't sufficient.
:param title: Window title text to check.
:returns: True if the title contains a blacklisted keyword.
Example¶
is_excluded_window("Visual Studio Code - project.py") True is_excluded_window("report.docx - Microsoft Word") False is_excluded_window(None) False
load_local_exclusions ¶
Load or seed the smrt-detect local source exclusion contract.
The configuration file lives at
%APPDATA%/SmrtHub/Config/smrt-detect/localsource-exclusions.json and adheres
to schema/localsource-exclusions.schema.json. When the file is absent the
packaged defaults are written before returning the payload.
:return: Exclusion payload containing process, directory, keyword, and extension filters. :rtype: dict[str, Any]
python_core.config.user_flags¶
Runtime feature flags shared across python_core components.
Flags are transient in-memory toggles reset on process restart. They allow components to coordinate behavior without persisting experimental switches to disk.
See Also
SmrtApps/PythonApp/python_core/config/README.md
user_flags
module-attribute
¶
user_flags: dict[str, bool] = {
"group_by_source": False,
"group_by_filetype": True,
"group_by_date": False,
}
Mutable runtime feature toggles; modifying entries changes behavior immediately.