From e94f85b61ec033d51df38899c2b48e7e0cd5a308 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Thu, 20 Jul 2023 08:33:18 -0300 Subject: [PATCH] Refactor version check to include the package name in the URL and print the current version. # Aider chat conversation: --- aider/versioncheck.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/aider/versioncheck.py b/aider/versioncheck.py index a09a2b536..787c76d3f 100644 --- a/aider/versioncheck.py +++ b/aider/versioncheck.py @@ -1,16 +1,19 @@ import requests import pkg_resources +import aider + +from aider.dump import dump def check_version(): - response = requests.get('https://pypi.org/pypi/aider/json') + response = requests.get('https://pypi.org/pypi/aider-chat/json') data = response.json() latest_version = data['info']['version'] - current_version = pkg_resources.get_distribution('aider').version + current_version = pkg_resources.get_distribution('aider-chat').version - if pkg_resources.parse_version(latest_version) > pkg_resources.parse_version(current_version): - print(f"A newer version of 'aider' is available: {latest_version}") - else: - print("You are using the latest version of 'aider'.") + if pkg_resources.parse_version(latest_version) <= pkg_resources.parse_version(current_version): + return + + print(f"Running aider version {current_version}, newer version available: {latest_version}") if __name__ == "__main__": check_version()