10
10
11
11
logger = logging .getLogger (__name__ )
12
12
13
- here = Path (__file__ )
14
-
15
-
16
- DEFAULT_CONFIG_PATH = here .parent / "default_config.toml"
13
+ DEFAULT_CONFIG_PATH = Path (__file__ ).parent / "default_config.toml"
17
14
18
15
19
16
def remote_config (gh : Github , org_repo : str , * , rev : str ):
17
+ """Return configuration options in remote pyproject.toml if they exist."""
20
18
repo = gh .get_repo (org_repo )
21
19
try :
22
20
file = repo .get_contents ("pyproject.toml" , ref = rev )
@@ -30,6 +28,7 @@ def remote_config(gh: Github, org_repo: str, *, rev: str):
30
28
31
29
32
30
def local_config (path : Path ) -> dict :
31
+ """Return configuration options in local TOML file if they exist."""
33
32
with path .open ("rb" ) as fp :
34
33
config = tomllib .load (fp )
35
34
config = config .get ("tool" , {}).get ("changelist" , {})
@@ -39,6 +38,11 @@ def local_config(path: Path) -> dict:
39
38
def add_config_defaults (
40
39
config : dict , * , default_config_path : Path = DEFAULT_CONFIG_PATH
41
40
) -> dict :
41
+ """Fill in default config options if they don't exist in `config`.
42
+
43
+ The options are taken from the TOML file given in `default_config_path`.
44
+ Collections such as lists aren't merged.
45
+ """
42
46
with default_config_path .open ("rb" ) as fp :
43
47
defaults = tomllib .load (fp )
44
48
defaults = defaults ["tool" ]["changelist" ]
0 commit comments