python: actually fix python 3.8 compatibility (#1973)

importlib.resources.files also didn't exist until python 3.9.

Fixes #1972

Signed-off-by: Jared Van Bortel <jared@nomic.ai>
pull/2040/head
Jared Van Bortel 4 months ago committed by GitHub
parent a59645c839
commit 4a16a920a3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1,7 +1,6 @@
from __future__ import annotations
import ctypes
import importlib.resources
import logging
import os
import platform
@ -13,11 +12,16 @@ from enum import Enum
from queue import Queue
from typing import Callable, Iterable, List
if sys.version_info >= (3, 9):
import importlib.resources as importlib_resources
else:
import importlib_resources
logger: logging.Logger = logging.getLogger(__name__)
# TODO: provide a config file to make this more robust
MODEL_LIB_PATH = importlib.resources.files("gpt4all") / "llmodel_DO_NOT_MODIFY" / "build"
MODEL_LIB_PATH = importlib_resources.files("gpt4all") / "llmodel_DO_NOT_MODIFY" / "build"
def load_llmodel_library():

@ -86,7 +86,11 @@ setup(
],
python_requires='>=3.8',
packages=find_packages(),
install_requires=['requests', 'tqdm'],
install_requires=[
'requests',
'tqdm',
'importlib_resources; python_version < "3.9"',
],
extras_require={
'dev': [
'pytest',

Loading…
Cancel
Save