Skip to content

Commit

Permalink
Enable installing on python < 3.7 (#494)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hedingber committed Oct 25, 2020
1 parent 68b39eb commit 0bf0a0b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
9 changes: 7 additions & 2 deletions mlrun/utils/version/version.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import importlib.resources
import json
import sys

import mlrun.utils
from mlrun.utils.singleton import Singleton

if sys.version_info >= (3, 7):
from importlib.resources import read_text
else:
from importlib_resources import read_text


class Version(metaclass=Singleton):
def __init__(self):
Expand All @@ -12,7 +17,7 @@ def __init__(self):
self.version_info = {"git_commit": "unknown", "version": "unstable"}
try:
self.version_info = json.loads(
importlib.resources.read_text("mlrun.utils.version", "version.json")
read_text("mlrun.utils.version", "version.json")
)
except Exception:
mlrun.utils.logger.warning(
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ google-auth<2.0dev,>=1.19.1
azure-storage-blob
pydantic~=1.5
orjson>=3,<4
importlib-resources; python_version < '3.7'

0 comments on commit 0bf0a0b

Please sign in to comment.