Skip to content

Commit a5be6ea

Browse files
author
Steven Silvester
authored
Merge pull request #137 from jtpio/config-files-check
Fix handling of releaser config in multiple files
2 parents 506beb6 + 0ca001f commit a5be6ea

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

jupyter_releaser/util.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -271,21 +271,26 @@ def retry(cmd, **kwargs):
271271

272272
def read_config():
273273
"""Read the jupyter-releaser config data"""
274-
config = {}
274+
config = None
275+
275276
if JUPYTER_RELEASER_CONFIG.exists():
276277
config = toml.loads(JUPYTER_RELEASER_CONFIG.read_text(encoding="utf-8"))
277278

278-
elif PYPROJECT.exists():
279+
if not config and PYPROJECT.exists():
279280
data = toml.loads(PYPROJECT.read_text(encoding="utf-8"))
280-
config = data.get("tool", {}).get("jupyter-releaser") or {}
281+
pyproject_config = data.get("tool", {}).get("jupyter-releaser")
282+
if pyproject_config:
283+
config = pyproject_config
281284

282-
elif PACKAGE_JSON.exists():
285+
if not config and PACKAGE_JSON.exists():
283286
data = json.loads(PACKAGE_JSON.read_text(encoding="utf-8"))
284287
if "jupyter-releaser" in data:
285288
config = data["jupyter-releaser"]
286289

287290
with open(osp.join(HERE, "schema.json")) as fid:
288291
schema = json.load(fid)
292+
293+
config = config or {}
289294
validator = Validator(schema)
290295
validator.validate(config)
291296
return config

0 commit comments

Comments
 (0)