feat(cli): show version update notice#602
Conversation
Signed-off-by: Eric W. Tramel <eric.tramel@gmail.com>
Signed-off-by: Eric W. Tramel <eric.tramel@gmail.com>
PR #602 Review —
|
Greptile SummaryThis PR adds a PyPI-backed version update notice to
|
| Filename | Overview |
|---|---|
| packages/data-designer/src/data_designer/cli/version_notice.py | New file implementing PyPI version check with caching, Python-compat filtering, and installer detection — logic is correct and hardened. |
| packages/data-designer/src/data_designer/cli/main.py | Wires update notice into --version callback behind TTY check; lazy import and broad exception catch keep the version output script-safe. |
| packages/data-designer/src/data_designer/cli/ui.py | Adds print_update_notice helper using Rich Panel.fit with Nord theme colors — straightforward addition, no issues. |
| packages/data-designer/tests/cli/test_version_notice.py | 415-line test suite covering cache hits/misses/expiry/schema, prerelease opt-in, Python-compat filtering, yanked releases, network failure, and all upgrade-command paths. |
| packages/data-designer/tests/cli/test_main.py | Extends existing CLI tests to cover TTY guard, notice rendering, lookup failure, and non-TTY skipping scenarios. |
| packages/data-designer/pyproject.toml | Adds packaging>=25,<27 as a direct runtime dependency for PEP 440 version parsing. |
| packages/data-designer-config/src/data_designer/config/utils/constants.py | Centralizes DATA_DESIGNER_PACKAGE_NAME constant to avoid drift between metadata lookup, cache, PyPI URL, and upgrade hint strings. |
Reviews (9): Last reviewed commit: "Merge branch 'main' into codex/issue-598..." | Re-trigger Greptile
Signed-off-by: Eric W. Tramel <eric.tramel@gmail.com>
Signed-off-by: Eric W. Tramel <eric.tramel@gmail.com>
|
Thanks for putting this together, @eric-tramel — really nice attention to fail-closed behavior and cache hygiene throughout. SummaryAdds an opportunistic FindingsWarnings — Worth addressing
Suggestions — Take it or leave it
What Looks Good
VerdictNeeds changes — the private-API test coupling and the test gap around the suffix heuristic are worth addressing before merge; the |
Signed-off-by: Eric W. Tramel <eric.tramel@gmail.com>
Signed-off-by: Eric W. Tramel <eric.tramel@gmail.com>
|
All actionable feedback from Andre, Nabin, Greptile, and the agentic CI review pass has been addressed in this PR. Summary of the cleanup:
Validation is green locally and on the required GitHub checks. The broader GitHub matrix was green when last checked; Greptile was the only external check still pending at that point. |
andreatgretel
left a comment
There was a problem hiding this comment.
Final pass looks good - all the items from the previous round are addressed cleanly (pip fallback, requires_python filter, package-name constant, narrowed exception, urlopen tests). One small thing before I approve:
Now that the outer except is narrowed, the print_update_notice call and the from data_designer.cli.ui import print_update_notice / from data_designer.cli.version_notice import get_update_notice imports at main.py:38-47 sit outside the try block. An unexpected error there (ImportError on the lazy import, or anything from the Rich render) will exit 1 after the version line was already echoed, which regresses the "always exit 0 on --version" contract the broader except Exception was previously guarding.
Easiest fix is to pull the imports + render into the same try, e.g.:
try:
from data_designer.cli.ui import print_update_notice
from data_designer.cli.version_notice import get_update_notice
notice = get_update_notice(installed_version)
if notice is not None:
print_update_notice(notice.latest_version, notice.upgrade_command)
except (OSError, RuntimeError, ValueError, ImportError):
pass
raise typer.Exit()Happy to approve once that's in.
|
Greptile encountered an error while reviewing this PR. Please reach out to support@greptile.com for assistance. |
📋 Summary
Adds a PyPI-backed update notice to
data-designer --versionwhile preserving the installed version as the first output line. The notice is intentionally opportunistic: scripted/non-TTY output, local development versions, network failures, malformed PyPI data, cache failures, and Python-incompatible releases all skip the CTA instead of disrupting version output.🔗 Related Issue
Fixes #598
🔄 Changes
DATA_DESIGNER_DISABLE_VERSION_CHECK, andDATA_DESIGNER_VERSION_CHECK_PRERELEASES.data-designer --versionremains script-friendly.requires_pythonincompatibility.pip install --upgrade data-designerby default and for plain pip virtualenvs,uv add --upgrade data-designerfor uv project environments,uv tool upgrade data-designerfor uv-tool installs, andpipx upgrade data-designerfor pipx installs.uv/toolsare not misclassified as uv-tool installs.data-designerpackage name constant in config constants to keep metadata lookup, cache records, PyPI URL, and upgrade hints aligned.packagingas a direct runtime dependency for PEP 440 version comparison and Python compatibility checks.requires_pythonfiltering, and upgrade command selection.Usage Examples
Local development checkout output, captured from this branch:
Opted-out version check output, captured from this branch:
Interactive update-available rendering, captured from the CLI
--versionpath with the installed version set to0.5.10and latest version set to0.5.11for deterministic output:🧪 Testing
make testpasses (not run; package suites run instead)make check-configmake check-interfacemake test-config(551 passed)make test-interface(692 passed)uv run --package data-designer pytest packages/data-designer/tests/cli/test_main.py packages/data-designer/tests/cli/test_version_notice.py(35 passed)uv run --package data-designer data-designer --versionDATA_DESIGNER_DISABLE_VERSION_CHECK=1 uv run --package data-designer data-designer --version--versionupdate-available rendering run✅ Checklist