Skip to content

Commit d260f1c

Browse files
authored
Fallback to old python-json-logger import path (#848)
Maintain compatibility with python-json-logger 2.x due to stagnation of the conda-forge feedstock. conda-forge/python-json-logger-feedstock#19
1 parent ac553f7 commit d260f1c

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

WDL/_util.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,14 @@
2929
TYPE_CHECKING,
3030
)
3131
from types import FrameType
32-
from pythonjsonlogger import json as jsonlogger
32+
from importlib.util import find_spec
33+
34+
# Prefer the non-deprecated import path, but keep compatibility with python-json-logger
35+
# 2.0.7 while conda-forge catches up: https://github.com/conda-forge/python-json-logger-feedstock/issues/19
36+
if find_spec("pythonjsonlogger.json") is not None:
37+
from pythonjsonlogger import json as jsonlogger
38+
else:
39+
from pythonjsonlogger import jsonlogger # type: ignore[no-redef]
3340

3441
if TYPE_CHECKING:
3542
from . import Env, Value

0 commit comments

Comments
 (0)