Skip to content

scripts/config

scripts.config.__init__

🧠 Docstring Summary

Section Content
Description The config module centralizes application configuration management and logging setup.
Core features include:
- Loading, validating, and caching application settings from JSON configuration files.
- Providing a Pydantic-based configuration model for type-safe access to settings.
- Managing environment-specific and test-mode configurations.
- Utilities for safe file reading and error handling during configuration loading.
- Centralized logging setup for consistent application-wide logging behavior.
This module ensures robust, maintainable, and flexible configuration and logging for the entire application.
Args
Returns

scripts.config.config_loader

🧠 Docstring Summary

Section Content
Description No module description available.
Args
Returns

🛠️ Functions

setup_logging

Configures centralized logging for the application. Sets the logging level to INFO, applies a standard log message format, and directs output to the console. Returns: None

load_config

Loads a JSON configuration file from the specified path, returning its contents as a dictionary. If the file does not exist, cannot be read, or contains invalid JSON, returns an empty dictionary. Adjusts the logger level to DEBUG if "test_mode" is enabled in the configuration; otherwise, sets it to INFO. Parameters: ['config_path: Path'] Returns: Dict[str, Any]

get_config_value

Retrieves a value from the configuration dictionary by key, returning a default if missing. Logs a warning if the key is not present in the configuration. Parameters: ['config: Dict[str, Any]', 'key: str', 'default: Any'] Returns: Any

get_absolute_path

Resolves an absolute path by joining the project base directory with a relative path. Parameters: ['relative_path: str'] Returns: Path

is_test_mode

Determines whether test mode is enabled in the configuration. If no configuration is provided, loads the default configuration. Parameters: ['config: Optional[Dict[str, Any]]'] Returns: bool

get_effective_config

Loads the configuration and overrides paths with test-safe equivalents if test mode is enabled. If 'test_mode' is set in the configuration, certain directory and file paths are replaced with test-specific values to prevent interference with production data. Parameters: ['config_path: Path'] Returns: Dict[str, Any]

scripts.config.config_manager

🧠 Docstring Summary

Section Content
Description config_manager.py
This module provides centralized management of application configuration using a Pydantic-based model.
Core features include:
- Defining a comprehensive AppConfig model for all configurable application parameters.
- Loading, validating, and caching configuration from a JSON file.
- Utility methods for retrieving configuration values, resetting the config cache, and validating critical config paths.
- Integration with safe file reading utilities for resilience against missing or malformed config files.
Intended for use throughout the application to ensure consistent, validated configuration management.
Args
Returns

📦 Classes

AppConfig

Configuration model for application settings. Defines all configurable parameters for the application, including UI, logging, LLM and embedding model settings, file paths, test mode, and plugin management. Ignores any extra fields not explicitly defined. Returns: None

Config

No description available. Returns: None

ConfigManager

Manages application configuration loading, caching, and validation. Provides methods to load configuration from a JSON file using the AppConfig model, retrieve configuration values, reset the cached config, and validate critical config paths. Handles missing or invalid config files by returning default settings and logs relevant events. Returns: None

🛠️ Functions

_default_config

Return a fresh copy of the pre-instantiated default config. Parameters: ['cls: Any'] Returns: AppConfig

load_config

Loads the application configuration from a JSON file, with optional cache refresh. If the config file is missing or invalid, returns a default AppConfig instance. Caches the loaded config and reloads if the file changes or force_reload is True. Logs relevant events and raises on validation errors. Parameters: ['cls: Any', 'config_path: str', 'force_reload: bool'] Returns: AppConfig

get_value

Retrieve a configuration value by key from the loaded AppConfig. Parameters: ['cls: Any', 'key: str', 'default: Any', 'force_reload: bool'] Returns: Any

reset

Reset the cached configuration and timestamp. Parameters: ['cls: Any'] Returns: None

validate_config_paths

Validate that critical config paths have existing parent directories. Logs a warning for each missing directory. Returns True if all required directories exist, otherwise False. Parameters: ['cls: Any'] Returns: bool

scripts.config.constants

🧠 Docstring Summary

Section Content
Description constants.py
This module defines global constants used throughout the Zephyrus Logger application.
Core features include:
- Timestamp and date formatting strings for consistent time representation.
- Standardized JSON keys for batch processing, summaries, and content tracking.
- Keys for summary tracking and logging statistics.
- Default configuration values for batch size, autosave interval, and log level.
- Default file suffixes and extensions for summary and markdown files.
- Centralized UI default settings, such as theme.
Intended to provide a single source of truth for application-wide constants, improving maintainability and consistency.
Args
Returns

scripts.config.logging_setup

🧠 Docstring Summary

Section Content
Description logging_setup.py
This module provides centralized logging configuration for the application.
Core features include:
- Defining a setup_logging function to initialize the root logger with a specified log level.
- Clearing existing handlers and adding a console handler with a standardized log message format.
- Automatically configuring logging upon import for convenience and consistency across the application.
Intended for use as the standard logging setup to ensure uniform log formatting and log level management.
Args
Returns

🛠️ Functions

setup_logging

Configures the root logger with a specified log level and standardized console output. Initializes application-wide logging by setting the root logger's level, clearing any existing handlers, and adding a console handler with a consistent log message format. If an invalid log level is provided, defaults to INFO. Parameters: ['log_level: Any'] Returns: Any