mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-01 10:14:59 +00:00

# Aider chat conversation: USER: also print the command the user should use to upgrade ASSISTANT: To print the command the user should use to upgrade, we can add a print statement in the `check_version` function in the `aider/versioncheck.py` file. This print statement will provide the command to upgrade the `aider-chat` package using pip. Here is the code: ```python aider/versioncheck.py <<<<<<< ORIGINAL import requests import pkg_resources import aider from aider.dump import dump def check_version(): 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-chat').version 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() ======= import requests import pkg_resources import aider from aider.dump import dump def check_version(): 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-chat').version 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}") print("To upgrade, run: pip install --upgrade aider-chat") if __name__ == "__main__": check_version() >>>>>>> UPDATED ``` This will print the command `pip install --upgrade aider-chat` when a newer version is available. The user can then copy this command and run it in their terminal to upgrade the `aider-chat` package.
20 lines
642 B
Python
20 lines
642 B
Python
import requests
|
|
import pkg_resources
|
|
import aider
|
|
|
|
from aider.dump import dump
|
|
|
|
def check_version():
|
|
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-chat').version
|
|
|
|
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}")
|
|
print("To upgrade, run: pip install --upgrade aider-chat")
|
|
|
|
if __name__ == "__main__":
|
|
check_version()
|