Make AuDaGe look for the config.yaml file relative to the __init__ module.

This commit is contained in:
2026-11-05 20:57:06 -06:00
parent ac000ceb17
commit 78611c5ee2

View File

@@ -8,12 +8,18 @@ date: 2026-10-30
desc: Global variables for the AuDaGe package. desc: Global variables for the AuDaGe package.
""" """
from importlib import resources
import yaml import yaml
CONFIG_PATH = "../../config.yaml"
safe: bool = True safe: bool = True
"""Default to disallowing evaluating Python from YAML files. Can be overridden """Default to disallowing evaluating Python from YAML files. Can be overridden
when calling AuDaGe from the command line with the argument `--unsafe`. when calling AuDaGe from the command line with the argument `--unsafe`.
""" """
with open("config.yaml") as config_file: config_path = resources.files().joinpath(CONFIG_PATH)
folders = yaml.safe_load(config_file.read())["folders"]
with config_path.open("r") as config_file:
folders: list[str] = yaml.safe_load(config_file.read())["folders"]