mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-02 18:54:59 +00:00
Refactor version check to include the package name in the URL and print the current version.
# Aider chat conversation:
This commit is contained in:
parent
cf8f76533d
commit
e94f85b61e
1 changed files with 9 additions and 6 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue