Skip to content

Commit 42212a2

Browse files
author
Steven Silvester
authored
Merge pull request #140 from jtpio/read-schema
Read the schema on import
2 parents 5af9ea7 + daab081 commit 42212a2

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

jupyter_releaser/util.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@
4242
RELEASE_API_PATTERN = "https://api.github.com/repos/(?P<owner>[^/]+)/(?P<repo>[^/]+)/releases/tags/(?P<tag>.*)"
4343

4444

45+
SCHEMA = files("jupyter_releaser").joinpath("schema.json").read_text()
46+
SCHEMA = json.loads(SCHEMA)
47+
48+
4549
def run(cmd, **kwargs):
4650
"""Run a command as a subprocess and get the output as a string"""
4751
quiet_error = kwargs.pop("quiet_error", False)
@@ -287,10 +291,7 @@ def read_config():
287291
if "jupyter-releaser" in data:
288292
config = data["jupyter-releaser"]
289293

290-
schema = files("jupyter_releaser").joinpath("schema.json").read_text()
291-
schema = json.loads(schema)
292-
293294
config = config or {}
294-
validator = Validator(schema)
295+
validator = Validator(SCHEMA)
295296
validator.validate(config)
296297
return config

0 commit comments

Comments
 (0)