Skip to content

Commit ee13c81

Browse files
committed
reduce usage of deprecated pkg_resources APIs
1 parent f64af8e commit ee13c81

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

cwl_utils/sandboxjs.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
cast,
2626
)
2727

28-
from pkg_resources import resource_stream
28+
from importlib_resources import files
2929
from schema_salad.utils import json_dumps
3030

3131
from cwl_utils.errors import JavascriptException, WorkflowException
@@ -196,8 +196,7 @@ def exec_js_process(
196196
nodejs = self.localdata.procs.get(js_engine)
197197

198198
if nodejs is None or nodejs.poll() is not None:
199-
res = resource_stream(__name__, js_engine)
200-
js_engine_code = res.read().decode("utf-8")
199+
js_engine_code = files("cwl_utils").joinpath(js_engine).read_text("utf-8")
201200

202201
created_new_process = True
203202

docs/conf.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,24 @@
66

77
# -- Path setup --------------------------------------------------------------
88

9+
import importlib.metadata
10+
911
# If extensions (or modules to document with autodoc) are in another directory,
1012
# add these directories to sys.path here. If the directory is relative to the
1113
# documentation root, use os.path.abspath to make it absolute, like shown here.
1214
#
1315
import os
1416
import sys
1517
import time
16-
from datetime import datetime
17-
18-
from pkg_resources import get_distribution
18+
from datetime import UTC, datetime
1919

2020
sys.path.insert(0, os.path.abspath(".."))
2121

2222

2323
# -- Project information -----------------------------------------------------
2424

25-
build_date = datetime.utcfromtimestamp(
26-
int(os.environ.get("SOURCE_DATE_EPOCH", time.time()))
25+
build_date = datetime.fromtimestamp(
26+
int(os.environ.get("SOURCE_DATE_EPOCH", time.time())), UTC
2727
)
2828
project = "cwl-utils: Python utilities Common Workflow Language documents"
2929
copyright = f"2019 — {build_date.year} CWL Community"
@@ -82,7 +82,7 @@
8282
# so a file named "default.css" will overwrite the builtin "default.css".
8383
html_static_path = ["_static"]
8484

85-
release = get_distribution("cwl-utils").version
85+
release = importlib.metadata.version("cwl_utils")
8686
version = ".".join(release.split(".")[:2])
8787

8888
autoapi_dirs = ["../cwl_utils"]

0 commit comments

Comments
 (0)