Skip to content

Add CLI and server version checks with upgrade guidance#1677

Merged
aliasaria merged 5 commits intomainfrom
add/cli-version-check
Mar 27, 2026
Merged

Add CLI and server version checks with upgrade guidance#1677
aliasaria merged 5 commits intomainfrom
add/cli-version-check

Conversation

@aliasaria
Copy link
Copy Markdown
Member

Summary

  • lab version now 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 running lab server update when outdated. Supports --format json.
  • The background update banner on every CLI command now checks the CLI version via PyPI (not the server version), with a 4-hour file-based cache at ~/.lab/.version_cache.json.
  • Fixed a bug in _get_current_version() that called .read_text() on a str instead of using open().

Test plan

  • All 89 CLI tests pass (cd cli && python -m pytest tests/ -v)
  • Lint clean (ruff check and ruff format --check)
  • Manual: lab version shows CLI version + PyPI update status
  • Manual: lab server version shows server version + GitHub update status
  • Manual: lab status shows background CLI version banner when outdated

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-review
Copy link
Copy Markdown

Paragon Summary

This 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: lab version now checks the installed CLI against PyPI with upgrade guidance, and the new lab server version checks the installed server against GitHub releases with update instructions. It also switches the global update banner to validate the CLI version with a cached 4-hour PyPI lookup and fixes a version-reading bug.

Key changes:

  • Added lab version CLI upgrade check against PyPI, with JSON output and exact upgrade command guidance.
  • Added new lab server version command to compare installed server version with GitHub releases and recommend lab server update.
  • Updated the global background version banner to check the CLI version via PyPI, using a 4-hour file cache.
  • Fixed _get_current_version() to read the version file correctly with open() instead of calling .read_text() on a string.
  • Added/updated tests for server version command, CLI version behavior, and PyPI cache handling.

Confidence score: 4/5

  • This PR has low-moderate risk with 3 medium-priority issues identified
  • Score reflects code quality concerns and maintainability issues
  • Consider addressing medium-priority findings to improve code quality

7 files reviewed, 4 comments

Severity breakdown: Medium: 3, Low: 1


Tip: @paragon-run <instructions> to chat with our agent or push fixes!

Dashboard

- _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
@aliasaria aliasaria merged commit 6a4dd27 into main Mar 27, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant