config¶
TOML configuration loading. See the Configuration guide for the file's contents and lookup order.
config
¶
Configuration file loading for gridcalc.
Lookup order (first found wins, CWD overrides user config): 1. ./gridcalc.toml 2. $XDG_CONFIG_HOME/gridcalc/gridcalc.toml (default: ~/.config/gridcalc/gridcalc.toml)
Config
dataclass
¶
Config(
editor: str = "",
sandbox: bool = True,
width: int = 0,
format: str = "",
libs: list[str] = list(),
allowed_modules: list[str] = list(),
keys: dict[str, dict[str, list[ParsedKey]]] = dict(),
config_path: str = "",
warnings: list[str] = list(),
)
load_config
¶
load_config(path: Path | str | None = None) -> Config
Load configuration from a TOML file.
If path is None, uses the standard lookup order. On a parse error or
missing file, returns a default Config (with the parse error reported
via cfg.warnings and printed to stderr by the caller, if desired).
Source code in src/gridcalc/config.py
find_config
¶
Find the first gridcalc.toml in the lookup order.
Source code in src/gridcalc/config.py
user_config_dir
¶
Return the user-level config directory (XDG_CONFIG_HOME/gridcalc).