Skip to content

Commit 78be2b7

Browse files
committed
Use importlib_resources to read schema.json
1 parent a5be6ea commit 78be2b7

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

jupyter_releaser/util.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@
1818
from subprocess import PIPE
1919

2020
import toml
21+
from importlib_resources import files
2122
from jsonschema import Draft4Validator as Validator
2223
from pkg_resources import parse_version
2324

2425
from jupyter_releaser.tee import run as tee
2526

26-
HERE = osp.dirname(osp.abspath(__file__))
2727
PYPROJECT = Path("pyproject.toml")
2828
SETUP_PY = Path("setup.py")
2929
SETUP_CFG = Path("setup.cfg")
@@ -287,8 +287,8 @@ def read_config():
287287
if "jupyter-releaser" in data:
288288
config = data["jupyter-releaser"]
289289

290-
with open(osp.join(HERE, "schema.json")) as fid:
291-
schema = json.load(fid)
290+
schema = files("jupyter_releaser").joinpath("schema.json").read_text()
291+
schema = json.loads(schema)
292292

293293
config = config or {}
294294
validator = Validator(schema)

setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ install_requires =
3232
click
3333
ghapi
3434
github-activity~=0.1
35+
importlib_resources
3536
jsonschema>=3.0.1
3637
pre-commit
3738
pypiserver

0 commit comments

Comments
 (0)