Skip to content

Commit

Permalink
check version is latest
Browse files Browse the repository at this point in the history
  • Loading branch information
sylvaingaudan committed Sep 16, 2024
1 parent 1ba67a4 commit 5181a4c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions arlas/cli/cli.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import requests
import typer
import os
import sys
Expand Down Expand Up @@ -62,6 +63,18 @@ def init(


def main():
try:
json = requests.get('https://pypi.org/pypi/arlas.cli/json').json()
if json:
version = json.get("info", {}).get("version", None)
if version:
if not version == arlas_cli_version:
print("WARNING: You are not using the latest version of arlas_cli! Please update with:", file=sys.stderr)
print("pip3.10 install arlas_cli==" + version, file=sys.stderr)
else:
print("WARNING: Can not identify arlas.cli version.", file=sys.stderr)
except Exception:
print("WARNING: Can not contact pypi.org to identify if this arlas_cli is the latest version.", file=sys.stderr)
app.add_typer(collections, name="collections")
app.add_typer(indices, name="indices")
app.add_typer(persist, name="persist")
Expand Down

0 comments on commit 5181a4c

Please sign in to comment.