@@ -49,13 +49,22 @@ def load_config(config_path: str | Path | None = None) -> OmegaConf:
4949 """
5050 logger .info ('Starting configuration load' )
5151 paths = resolve_config_paths ()
52+ logger .debug ('Resolved config paths: %s' , paths )
5253 parts = [
5354 load_existing (paths ['ecosystem' ]),
5455 read_package_default (),
5556 load_existing (paths ['user' ]),
5657 load_existing (paths ['cwd' ]),
5758 load_existing (paths ['env' ]),
5859 ]
60+ logger .info (
61+ 'Merging configuration sources: ecosystem=%s, package=%s, user=%s, cwd=%s, env=%s' ,
62+ bool (paths ['ecosystem' ] and paths ['ecosystem' ].exists ()),
63+ True ,
64+ bool (paths ['user' ] and paths ['user' ].exists ()),
65+ bool (paths ['cwd' ] and paths ['cwd' ].exists ()),
66+ bool (paths ['env' ] and paths ['env' ].exists ()),
67+ )
5968
6069 if config_path :
6170 custom_path = Path (config_path )
@@ -66,6 +75,8 @@ def load_config(config_path: str | Path | None = None) -> OmegaConf:
6675 logger .warning (
6776 'Custom config path does not exist: %s' , custom_path
6877 )
78+ else :
79+ logger .debug ('No custom config path provided' )
6980
7081 config = merge_configs ([p for p in parts if p is not None ])
7182
@@ -88,6 +99,11 @@ def resolve_config_paths() -> dict[str, Path | None]:
8899 ecosystem_dir = Path (platformdirs .site_config_dir ('pkg_infra' ))
89100 user_dir = Path (platformdirs .user_config_dir ('pkg_infra' ))
90101 env_value = os .environ .get (ENV_VARIABLE_DEFAULT_CONFIG )
102+ if env_value is None :
103+ logger .debug (
104+ 'Env var %s not set; skipping env config' ,
105+ ENV_VARIABLE_DEFAULT_CONFIG ,
106+ )
91107
92108 paths = {
93109 'ecosystem' : ecosystem_dir / ECOSYSTEM_CONFIG_FILENAME ,
@@ -97,7 +113,6 @@ def resolve_config_paths() -> dict[str, Path | None]:
97113 'env' : Path (env_value ) if env_value else None ,
98114 'custom_path' : None ,
99115 }
100- logger .debug ('Resolved config paths: %s' , paths )
101116 return paths
102117
103118
@@ -138,6 +153,8 @@ def load_existing(path: Path | None) -> OmegaConf | None:
138153 if path and path .exists ():
139154 logger .debug ('Loading config file: %s' , path )
140155 return OmegaConf .load (path )
156+ if path :
157+ logger .debug ('Config file not found at %s; skipping' , path )
141158 return None
142159
143160
@@ -150,4 +167,6 @@ def merge_configs(parts: list[OmegaConf]) -> OmegaConf:
150167 Returns:
151168 OmegaConf: The merged configuration object.
152169 """
170+ if not parts :
171+ logger .warning ('No config parts found; using empty config' )
153172 return OmegaConf .merge (* parts ) if parts else OmegaConf .create ({})
0 commit comments