mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-06 04:35:00 +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 requests
|
||||||
import pkg_resources
|
import pkg_resources
|
||||||
|
import aider
|
||||||
|
|
||||||
|
from aider.dump import dump
|
||||||
|
|
||||||
def check_version():
|
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()
|
data = response.json()
|
||||||
latest_version = data['info']['version']
|
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):
|
if pkg_resources.parse_version(latest_version) <= pkg_resources.parse_version(current_version):
|
||||||
print(f"A newer version of 'aider' is available: {latest_version}")
|
return
|
||||||
else:
|
|
||||||
print("You are using the latest version of 'aider'.")
|
print(f"Running aider version {current_version}, newer version available: {latest_version}")
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
check_version()
|
check_version()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue