[CLI] Shortcut hf update when already on latest version#4177
Merged
Conversation
When the current version matches the latest version on PyPI, print a short up-to-date message and skip running the install command. Co-Authored-By: julien-agent <[email protected]>
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
Member
Author
|
CI flakiness is unrelated. |
Wauplin
approved these changes
May 4, 2026
Contributor
|
This PR has been shipped as part of the v1.14.0 release. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
hf updatenow prints the current version, checks PyPI for the latest, and short-circuits withhf is up to date (X.Y.Z)when they match — skipping the install command (which can be slow or prompt for sudo on brew)._fetch_latest_pypi_version()helper, reused by the existing daily update-check too.Example
Up-to-date case:
Out-of-date case (unchanged): falls through to the install command as before.
Note
Low Risk
Low risk: adds a simple PyPI version check and early-exit path in the
hf updatecommand; failures fall back to the existing update behavior.Overview
Improves
hf updateUX by short-circuiting when already up to date. The command now prints the current version, checks PyPI for the latesthuggingface_hubrelease, and returns early with an “up to date” message instead of running the installer.Extracts the PyPI lookup into a shared
_fetch_latest_pypi_version()helper (used by bothhf updateand the existing daily update hint), and makes network/version-check failures non-fatal by returningNoneand proceeding as before.Reviewed by Cursor Bugbot for commit 1b41c9d. Bugbot is set up for automated code reviews on this repo. Configure here.