mrv.utils – Configuration and logging

mrv.utils – Configuration, logging utilities.

Data downloads are dispatched through mrv.pipeline.download (source-aware). The IB-specific downloader is accessible as mrv.utils.download_ib.download if needed directly, but is not re-exported here.

mrv.utils.load(path=None)[source]

Load configuration from YAML.

Parameters:

path (Union[str, Path, None]) – If None, searches for config.yaml automatically.

Raises:

FileNotFoundError – If no config file found.

Return type:

Dict[str, Any]

mrv.utils.get_data_dir(cfg, base=None)[source]

Resolve data directory from config.

Return type:

Path

mrv.utils.get_assets(cfg, freq=None)[source]

Expand download.symbols into asset dicts.

Return type:

List[Dict[str, Any]]

mrv.utils.setup_logging(cfg=None)

Configure Python logging from the logging section of mrv config.

When logging.dir is set, a timestamped log file is created automatically, e.g. logs/mrv_20260319_143012.log.

Parameters:

cfg (Optional[Dict[str, Any]]) – Full mrv config dict (as returned by mrv.utils.config.load()). If None, sensible defaults are applied.

Return type:

None

Sub-modules

Configuration (YAML)

mrv.utils.config – Load YAML configuration.

Single source of truth is config.yaml. No built-in defaults to maintain.

mrv.utils.config.load(path=None)[source]

Load configuration from YAML.

Parameters:

path (Union[str, Path, None]) – If None, searches for config.yaml automatically.

Raises:

FileNotFoundError – If no config file found.

Return type:

Dict[str, Any]

mrv.utils.config.get_data_dir(cfg, base=None)[source]

Resolve data directory from config.

Return type:

Path

mrv.utils.config.get_assets(cfg, freq=None)[source]

Expand download.symbols into asset dicts.

Return type:

List[Dict[str, Any]]

Logging setup

mrv.utils.log – Logging setup driven by config.yaml.

Call setup(cfg) once at application start to configure console + optional file logging. All mrv modules use logging.getLogger(__name__) as usual.

mrv.utils.log.setup(cfg=None)[source]

Configure Python logging from the logging section of mrv config.

When logging.dir is set, a timestamped log file is created automatically, e.g. logs/mrv_20260319_143012.log.

Parameters:

cfg (Optional[Dict[str, Any]]) – Full mrv config dict (as returned by mrv.utils.config.load()). If None, sensible defaults are applied.

Return type:

None