Skip to content

Commit

Permalink
Update latest version checking to avoid warning in dev mode
Browse files Browse the repository at this point in the history
  • Loading branch information
WilliGautier committed Nov 5, 2024
1 parent 81fd2d9 commit 88a6407
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions arlas/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,16 @@ 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:
latest_version = json.get("info", {}).get("version", None)
if latest_version:
if arlas_cli_version == "_".join(["arlas", "cli", "versions"]):
# Local dev 'python3.10 -m arlas.cli.cli' usage
...
elif arlas_cli_version != latest_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)
print("pip3.10 install arlas_cli==" + latest_version, file=sys.stderr)
else:
print("WARNING: Can not identify arlas.cli version.", file=sys.stderr)
print("WARNING: Can not identify arlas.cli latest 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")
Expand Down

0 comments on commit 88a6407

Please sign in to comment.