Shared Services¶
Core infrastructure modules shared across the entire application. These services provide foundational functionality that all modules can depend on.
Package Overview¶
| Package | Purpose |
|---|---|
logging/ |
Async application logger with auto caller detection |
path_management/ |
Cross-platform path resolution (dev/deploy modes) |
rendering/ |
Icons, stylesheets, and document rendering |
prompt_dialogs/ |
Theme-aware message boxes, loading dialogs, input dialogs |
security/ |
OAuth authentication, encryption, organization sync |
settings/ |
Application settings management (QSettings wrapper) |
utils/ |
General utilities (date/time formatting) |
Quick Start¶
# Logging
from src.shared_services.logging.logger_factory import get_logger
logger = get_logger()
logger.info("Application started")
# Path management
from src.shared_services.path_management.api import get_path_manager
pm = get_path_manager()
config_path = pm.get_config_path("settings.json")
# Icons
from src.shared_services.rendering.icons.api import render_svg
from src.shared_services.rendering.icons.icon_paths import Icons
icon = render_svg(Icons.Action.Save, size=24)
# Stylesheets
from src.shared_services.rendering.stylesheets.api import get_stylesheet_manager
sm = get_stylesheet_manager()
sm.register(widget, [StylesheetPaths.Main])
# Dialogs
from src.shared_services.prompt_dialogs.api import show_info, show_error
show_info(parent, "Success", "Operation completed.")
# Settings
from src.shared_services.settings.settings_manager import SettingsManager
settings = SettingsManager()
theme = settings.get_setting("appearance/theme", "light")
Architecture Principles¶
- API Pattern: Each package exposes its public interface through
api.py - Singleton Services: Core services use singleton pattern for global access
- Theme-Aware: UI components register with StylesheetManager for automatic theme updates
- Local Imports: Logger should be imported locally in methods, not globally
What Belongs Here¶
Put in shared_services: - Infrastructure used by multiple modules (logging, paths, settings) - UI services (dialogs, stylesheets, icons) - Cross-cutting concerns (security, authentication)
Do NOT put here:
- Module-specific business logic (goes in modules/)
- Application-specific widgets (goes in custom_widgets/)
- Module-specific utilities (stay in their module's utils/)
Module Structure¶
src/shared_services/
__init__.py
README.md
constants/
paths.py # Shared path definitions
logging/
api.py, logger_factory.py, async_app_logger.py
path_management/
api.py, path_manager.py, path_types.py
rendering/
icons/ # SVG/font icon rendering
stylesheets/ # QSS theme management
documents/ # Markdown/document rendering
prompt_dialogs/
api.py # Message boxes, loading, input dialogs
security/
oauth/ # OAuth2 authentication
sync/ # Organization member sync
settings/
settings_manager.py # QSettings wrapper
utils/
time_and_date.py # EU date/time formatting