From 78611c5ee2d0d2839601347ffabf79da8eaf2131 Mon Sep 17 00:00:00 2001 From: Joshua Lucas Date: Thu, 5 Nov 2026 20:57:06 -0600 Subject: [PATCH] Make AuDaGe look for the config.yaml file relative to the __init__ module. --- src/AuDaGe/__init__.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/AuDaGe/__init__.py b/src/AuDaGe/__init__.py index c1879e4..0e95d0a 100644 --- a/src/AuDaGe/__init__.py +++ b/src/AuDaGe/__init__.py @@ -8,12 +8,18 @@ date: 2026-10-30 desc: Global variables for the AuDaGe package. """ +from importlib import resources + import yaml +CONFIG_PATH = "../../config.yaml" + safe: bool = True """Default to disallowing evaluating Python from YAML files. Can be overridden when calling AuDaGe from the command line with the argument `--unsafe`. """ -with open("config.yaml") as config_file: - folders = yaml.safe_load(config_file.read())["folders"] \ No newline at end of file +config_path = resources.files().joinpath(CONFIG_PATH) + +with config_path.open("r") as config_file: + folders: list[str] = yaml.safe_load(config_file.read())["folders"] \ No newline at end of file