neurocore.config.loader¶
Configuration loader for NeuroCore.
- Loads configuration with the following priority (highest wins):
Environment variables (
NEUROCORE_prefix, double underscore for nesting).env file (project root)
neurocore.yaml
Built-in defaults
Usage:
from neurocore.config import load_config
# Auto-detect project root (walks up from cwd)
config = load_config()
# Explicit project root
config = load_config(project_root=Path("/path/to/project"))
# Explicit config file
config = load_config(config_path=Path("custom-config.yaml"))
Functions¶
|
Walk up from start looking for neurocore.yaml. |
|
Load NeuroCore configuration. |
Module Contents¶
- neurocore.config.loader.find_project_root(start: pathlib.Path | None = None) pathlib.Path | None[source]¶
Walk up from start looking for neurocore.yaml.
- Parameters:
start – Directory to begin searching from. Defaults to cwd.
- Returns:
The directory containing neurocore.yaml, or None if not found.
- neurocore.config.loader.load_config(project_root: pathlib.Path | None = None, config_path: pathlib.Path | None = None) neurocore.config.schema.NeuroCoreConfig[source]¶
Load NeuroCore configuration.
- Priority (highest wins):
Environment variables (NEUROCORE_*)
.env file
neurocore.yaml
Built-in defaults (in schema.py)
- Parameters:
project_root – Explicit project root directory. If not provided, walks up from cwd looking for neurocore.yaml.
config_path – Explicit path to a config YAML file. If provided, project_root defaults to its parent directory.
- Returns:
Fully resolved NeuroCoreConfig.
- Raises:
ConfigError – If config file is specified but invalid.