nirs4all.config package

Submodules

Module contents

Configuration module for nirs4all.

Provides validation and schema utilities for pipeline and dataset configurations.

exception nirs4all.config.ConfigValidationError(errors: List[str], config_path: str | None = None)[source]

Bases: Exception

Exception raised when configuration validation fails.

errors

List of validation error messages.

config_path

Path to the configuration file (if any).

nirs4all.config.validate_config_file(config_path: str, config_type: str | None = None, check_files: bool = True, check_class_paths: bool = False) Tuple[bool, List[str], List[str]][source]

Validate a configuration file, auto-detecting type if not specified.

Parameters:
  • config_path – Path to the configuration file.

  • config_type – ‘pipeline’, ‘dataset’, or None for auto-detection.

  • check_files – For dataset configs, check if data files exist.

  • check_class_paths – For pipeline configs, verify class imports.

Returns:

Tuple of (is_valid, errors, warnings).

nirs4all.config.validate_dataset_config(config_source: str | Dict[str, Any], check_files: bool = True) Tuple[bool, List[str], List[str]][source]

Validate a dataset configuration.

Parameters:
  • config_source – Path to config file, or config dictionary.

  • check_files – If True, check that referenced data files exist.

Returns:

Tuple of (is_valid, errors, warnings).

nirs4all.config.validate_pipeline_config(config_source: str | Dict[str, Any], check_class_paths: bool = False) Tuple[bool, List[str], List[str]][source]

Validate a pipeline configuration.

Parameters:
  • config_source – Path to config file, or config dictionary.

  • check_class_paths – If True, verify that class paths are importable.

Returns:

Tuple of (is_valid, errors, warnings).