yi-config-starter 0.1.3__tar.gz → 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {yi_config_starter-0.1.3/yi_config_starter.egg-info → yi_config_starter-0.2.0}/PKG-INFO +1 -1
- {yi_config_starter-0.1.3 → yi_config_starter-0.2.0}/yi_config_starter/__init__.py +1 -1
- {yi_config_starter-0.1.3 → yi_config_starter-0.2.0}/yi_config_starter/config_starter.py +13 -0
- {yi_config_starter-0.1.3 → yi_config_starter-0.2.0/yi_config_starter.egg-info}/PKG-INFO +1 -1
- {yi_config_starter-0.1.3 → yi_config_starter-0.2.0}/LICENSE +0 -0
- {yi_config_starter-0.1.3 → yi_config_starter-0.2.0}/README.md +0 -0
- {yi_config_starter-0.1.3 → yi_config_starter-0.2.0}/pyproject.toml +0 -0
- {yi_config_starter-0.1.3 → yi_config_starter-0.2.0}/setup.cfg +0 -0
- {yi_config_starter-0.1.3 → yi_config_starter-0.2.0}/yi_config_starter.egg-info/SOURCES.txt +0 -0
- {yi_config_starter-0.1.3 → yi_config_starter-0.2.0}/yi_config_starter.egg-info/dependency_links.txt +0 -0
- {yi_config_starter-0.1.3 → yi_config_starter-0.2.0}/yi_config_starter.egg-info/requires.txt +0 -0
- {yi_config_starter-0.1.3 → yi_config_starter-0.2.0}/yi_config_starter.egg-info/top_level.txt +0 -0
|
@@ -5,6 +5,7 @@ from __future__ import annotations
|
|
|
5
5
|
|
|
6
6
|
import logging
|
|
7
7
|
import os
|
|
8
|
+
import re
|
|
8
9
|
import sys
|
|
9
10
|
from pathlib import Path
|
|
10
11
|
from threading import RLock
|
|
@@ -168,6 +169,8 @@ class ApplicationConfiguration:
|
|
|
168
169
|
{{XDG_CONFIG}} -> $XDG_CONFIG_HOME or "~/.config"
|
|
169
170
|
{{ENV:VAR_NAME}} -> value of environment variable VAR_NAME (empty if missing)
|
|
170
171
|
You can pass extra_placeholders to override or add tokens.
|
|
172
|
+
|
|
173
|
+
After replacements, raises ValueError if any unresolved {{...}} placeholders remain.
|
|
171
174
|
"""
|
|
172
175
|
# base mapping
|
|
173
176
|
appdata = os.environ.get("APPDATA") or str(Path.home() / ".config")
|
|
@@ -204,6 +207,16 @@ class ApplicationConfiguration:
|
|
|
204
207
|
text = text[:i] + env_val + text[j + 2:]
|
|
205
208
|
start = i + len(env_val)
|
|
206
209
|
|
|
210
|
+
# Fail fast if any unresolved placeholders remain.
|
|
211
|
+
# We consider anything shaped like {{...}} to be a placeholder at this stage.
|
|
212
|
+
unresolved = {m.group(1).strip() for m in re.finditer(r"\{\{([^{}]+)}}", text)}
|
|
213
|
+
if unresolved:
|
|
214
|
+
names = ", ".join(sorted(unresolved))
|
|
215
|
+
raise ValueError(
|
|
216
|
+
f"Unresolved placeholders in config after preprocessing: {names}. "
|
|
217
|
+
f"Define them via built-ins, extra_placeholders, or environment variables using {{ENV:NAME}}."
|
|
218
|
+
)
|
|
219
|
+
|
|
207
220
|
return text
|
|
208
221
|
|
|
209
222
|
def _read_yaml(self, path: Path, extra_placeholders: Optional[Dict[str, str]] = None) -> dict:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{yi_config_starter-0.1.3 → yi_config_starter-0.2.0}/yi_config_starter.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
{yi_config_starter-0.1.3 → yi_config_starter-0.2.0}/yi_config_starter.egg-info/top_level.txt
RENAMED
|
File without changes
|