Skip to content

[CLI] Shortcut hf update when already on latest version#4177

Merged
Wauplin merged 1 commit intomainfrom
cli-update-shortcut-up-to-date
May 4, 2026
Merged

[CLI] Shortcut hf update when already on latest version#4177
Wauplin merged 1 commit intomainfrom
cli-update-shortcut-up-to-date

Conversation

@julien-c
Copy link
Copy Markdown
Member

@julien-c julien-c commented May 1, 2026

Summary

  • hf update now prints the current version, checks PyPI for the latest, and short-circuits with hf is up to date (X.Y.Z) when they match — skipping the install command (which can be slow or prompt for sudo on brew).
  • If the PyPI fetch fails for any reason, the command falls through to running the update as before — no regression on the unhappy path.
  • Factored the PyPI version lookup into a small _fetch_latest_pypi_version() helper, reused by the existing daily update-check too.

Example

Up-to-date case:

$ hf update
Current version: 1.13.0
Checking for updates to latest version...
hf is up to date (1.13.0)

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 update command; failures fall back to the existing update behavior.

Overview
Improves hf update UX by short-circuiting when already up to date. The command now prints the current version, checks PyPI for the latest huggingface_hub release, 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 both hf update and the existing daily update hint), and makes network/version-check failures non-fatal by returning None and proceeding as before.

Reviewed by Cursor Bugbot for commit 1b41c9d. Bugbot is set up for automated code reviews on this repo. Configure here.

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]>
@julien-c julien-c requested review from Wauplin and hanouticelina May 1, 2026 11:21
@bot-ci-comment
Copy link
Copy Markdown

bot-ci-comment Bot commented May 1, 2026

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.

@julien-c
Copy link
Copy Markdown
Member Author

julien-c commented May 1, 2026

CI flakiness is unrelated.

@Wauplin Wauplin merged commit fc66852 into main May 4, 2026
20 of 21 checks passed
@Wauplin Wauplin deleted the cli-update-shortcut-up-to-date branch May 4, 2026 07:45
@huggingface-hub-bot
Copy link
Copy Markdown
Contributor

This PR has been shipped as part of the v1.14.0 release.

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.

2 participants