Add CLI and server version checks with upgrade guidance#1677
Conversation
Replace the server-based version check with a PyPI-based one so the CLI checks its own package version independently of the server. Add file-based caching (~/.lab/.version_cache.json, 4-hour TTL) to avoid hitting PyPI on every invocation. Enrich `lab version` to show update status and support --format json output. The background banner on every command now shows `uv tool upgrade transformerlab-cli` instead of a web link.
Add a new `lab server version` command that checks the installed server version against GitHub releases and advises running `lab server update` when outdated. Supports both pretty and JSON output formats. Also fix a bug in _get_current_version() which called .read_text() on a str path instead of using open().
Paragon SummaryThis pull request review identified 4 issues across 2 categories in 7 files. The review analyzed code changes, potential bugs, security vulnerabilities, performance issues, and code quality concerns using automated analysis tools. This PR adds version-awareness to the CLI and server commands: Key changes:
Confidence score: 4/5
7 files reviewed, 4 comments Severity breakdown: Medium: 3, Low: 1 Tip: |
- _parse_version now handles pre-release strings like '0.30.0rc1' by
extracting only the numeric release segments via regex
- server_version uses > comparison instead of != to avoid suggesting
downgrades when the local version is newer than GitHub latest
- version.py distinguishes "up to date" from "check failed" instead of
always showing green "You are up to date" on PyPI network failure
- is_update_available fallback returns ("unknown", None) instead of
re-calling get_installed_version() which could itself raise
Summary
lab versionnow checks the CLI package version against PyPI and shows whether an update is available, with the exact upgrade command (uv tool upgrade transformerlab-cli). Supports--format json.lab server version(new command) checks the installed server version against GitHub releases and advises runninglab server updatewhen outdated. Supports--format json.~/.lab/.version_cache.json._get_current_version()that called.read_text()on astrinstead of usingopen().Test plan
cd cli && python -m pytest tests/ -v)ruff checkandruff format --check)lab versionshows CLI version + PyPI update statuslab server versionshows server version + GitHub update statuslab statusshows background CLI version banner when outdated