北念
2024-07-24 8aa01036b6b7722344a537546c2d25e4e8798912
funasr/utils/version_checker.py
@@ -1,9 +1,10 @@
import requests
from packaging import version
from funasr import __version__  # Ensure that __version__ is defined in your package's __init__.py
def get_pypi_version(package_name):
    import requests
    url = f"https://pypi.org/pypi/{package_name}/json"
    response = requests.get(url)
    if response.status_code == 200:
@@ -13,7 +14,9 @@
        raise Exception("Failed to retrieve version information from PyPI.")
def check_for_update():
def check_for_update(disable=False):
    if disable:
        return
    current_version = version.parse(__version__)
    pypi_version = get_pypi_version("funasr")
@@ -21,4 +24,4 @@
        print(f"New version available: {pypi_version}. Your current version is {current_version}.")
        print('Please use the command "pip install -U funasr" to upgrade.')
    else:
        print("You are using the latest version of funasr.")
        print(f"You are using the latest version of funasr-{current_version}")