summaryrefslogtreecommitdiffstats
path: root/g4f/debug.py
diff options
context:
space:
mode:
Diffstat (limited to 'g4f/debug.py')
-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