summaryrefslogtreecommitdiffstats
path: root/g4f/debug.py
diff options
context:
space:
mode:
authorHeiner Lohaus <hlohaus@users.noreply.github.com>2023-12-11 02:50:33 +0100
committerHeiner Lohaus <hlohaus@users.noreply.github.com>2023-12-11 02:50:33 +0100
commitb2d02ed624f9354214228c3f4d5dcb1a74d792b3 (patch)
tree9b25c40faba70070869d5a260fabe7610e780435 /g4f/debug.py
parentAdd error classes (diff)
downloadgpt4free-b2d02ed624f9354214228c3f4d5dcb1a74d792b3.tar
gpt4free-b2d02ed624f9354214228c3f4d5dcb1a74d792b3.tar.gz
gpt4free-b2d02ed624f9354214228c3f4d5dcb1a74d792b3.tar.bz2
gpt4free-b2d02ed624f9354214228c3f4d5dcb1a74d792b3.tar.lz
gpt4free-b2d02ed624f9354214228c3f4d5dcb1a74d792b3.tar.xz
gpt4free-b2d02ed624f9354214228c3f4d5dcb1a74d792b3.tar.zst
gpt4free-b2d02ed624f9354214228c3f4d5dcb1a74d792b3.zip
Diffstat (limited to '')
-rw-r--r--g4f/debug.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/g4f/debug.py b/g4f/debug.py
index 85009277..1ee1506f 100644
--- a/g4f/debug.py
+++ b/g4f/debug.py
@@ -1,6 +1,6 @@
from os import environ
from requests import get
-from importlib.metadata import version, PackageNotFoundError
+from importlib.metadata import version as get_package_version, PackageNotFoundError
from subprocess import check_output, CalledProcessError, PIPE
from .errors import VersionNotFoundError
@@ -10,7 +10,7 @@ version_check = True
def get_version() -> str:
# Read from package manager
try:
- return version("g4f")
+ return get_package_version("g4f")
except PackageNotFoundError:
pass
# Read from docker environment
@@ -33,7 +33,7 @@ def check_pypi_version() -> None:
try:
version = get_version()
latest_version = get_lastet_version()
+ if version != latest_version:
+ print(f'New pypi version: {latest_version} (current: {version}) | pip install -U g4f')
except Exception as e:
- print(f'Failed to check g4f pypi version: {e}')
- if version != latest_version:
- print(f'New pypi version: {latest_version} (current: {version}) | pip install -U g4f') \ No newline at end of file
+ print(f'Failed to check g4f pypi version: {e}') \ No newline at end of file