python: replace deprecated pkg_resources with importlib (#1505)

This commit is contained in:
cebtenzzre
2023-10-12 13:35:27 -04:00
committed by GitHub
parent 3c45a555e9
commit 4d4275d1b8
2 changed files with 16 additions and 14 deletions

View File

@@ -4,13 +4,13 @@ The GPT4All CLI is a self-contained script based on the `gpt4all` and `typer` pa
REPL to communicate with a language model similar to the chat GUI application, but more basic.
"""
import importlib.metadata
import io
import pkg_resources # should be present as a dependency of gpt4all
import sys
import typer
from collections import namedtuple
from typing_extensions import Annotated
import typer
from gpt4all import GPT4All
@@ -79,7 +79,7 @@ def repl(
use_new_loop = False
try:
version = pkg_resources.Environment()['gpt4all'][0].version
version = importlib.metadata.version('gpt4all')
version_major = int(version.split('.')[0])
if version_major >= 1:
use_new_loop = True