Skip to content

[CLI] Add hf update + drop interactive update prompt#4131

Merged
Wauplin merged 16 commits into
mainfrom
cli-upgrade-command
Apr 27, 2026
Merged

[CLI] Add hf update + drop interactive update prompt#4131
Wauplin merged 16 commits into
mainfrom
cli-upgrade-command

Conversation

@Wauplin
Copy link
Copy Markdown
Collaborator

@Wauplin Wauplin commented Apr 22, 2026

Follow-up after discussion in #3983 (comment) (also see internal slack thread)

Summary

  • Drop the blocking interactive Y/n auto-update prompt at CLI startup. TTY detection was catching too many non-interactive contexts (CI runners, Homebrew post-install hooks, Jupyter) and hanging automation.
  • Replace it with a single stderr warning that points at the new hf update command.
  • Add hf update (grouped under help like env/version): detects how hf was installed (brew / standalone installer / pip) and runs the right command. Hints at hf skills upgrade on success so installed agent skills stay in sync with the new command surface.
  • Add HF_HUB_DISABLE_UPDATE_CHECK=1 to silence the startup PyPI check entirely (offline CI, quieter shell output). The check was already a no-op on dev / pre-release versions and 24h-cached.

Breaking change

The interactive auto-update prompt is gone. Users who relied on pressing Enter to accept an upgrade will now get a warning and run hf update themselves. No flag change, no scripting breakage — the prompt only ran in TTY sessions.

Notes / decisions

  • Removed _prompt_autoupdate entirely rather than gating it on a new heuristic. Once the prompt is gone the leftover check is just a 24h-cached PyPI GET + one stderr line — both harmless in CI. HF_HUB_DISABLE_UPDATE_CHECK is the only opt-out; no auto-detection of CI/NONINTERACTIVE/Jupyter (no premature abstraction).
  • Early-return inside _check_cli_update, not the outer check_cli_update wrapper — keeps the exception-swallowing guarantee.
  • hf update has no flags (no --yes): the user already opted in by running it. Transformers is not updateable from hf update — the helper still exists but isn't exposed.
  • Registered under topic="help" next to env/version — it's installation meta, not a Hub operation.
  • The skill's "Commands" section is regenerated automatically from the Typer tree, so hf update shows up without touching build_skill_md. Added a single tip bullet to _SKILL_TIPS.

Note

Medium Risk
Alters CLI startup behavior and introduces a new command that shells out to platform/package-manager update commands, so failures or mis-detected install methods could impact user workflows (though core Hub operations are unchanged).

Overview
Adds a new hf update command (wired into hf via system.update + _cli_utils.run_update) that detects the CLI installation method (Homebrew/standalone installer/pip) and runs the appropriate upgrade command, then hints to refresh installed skills.

Changes the CLI startup PyPI version check to be non-interactive by removing the blocking Y/n auto-update prompt and always emitting a one-line hint (pointing at hf update for huggingface_hub), with a new HF_HUB_DISABLE_UPDATE_CHECK env var to skip the check entirely.

Updates docs and generated CLI reference to document hf update and HF_HUB_DISABLE_UPDATE_CHECK, and adds a short tip in skills docs about upgrading via hf update.

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

- Replace the blocking Y/n auto-update prompt with a one-line stderr warning pointing to `hf upgrade`
- New `hf upgrade` command (under `help` topic) that picks the right command for the detected install method (brew/hf_installer/pip)
- New `HF_HUB_NO_UPDATE_CHECK` env var to silence the startup PyPI check entirely (handy for CI / quieter shells)
Comment thread src/huggingface_hub/cli/system.py Outdated
Comment thread src/huggingface_hub/cli/_cli_utils.py Outdated
Wauplin added 5 commits April 22, 2026 16:47
Surface non-zero pip/brew/installer exits via `typer.Exit` so scripts and CI can detect upgrade failures. Matches the convention in extensions.py.
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 2a09347. Configure here.

Comment thread src/huggingface_hub/cli/_cli_utils.py Outdated
Comment thread src/huggingface_hub/cli/_cli_utils.py
@bot-ci-comment
Copy link
Copy Markdown

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.

Wauplin and others added 3 commits April 22, 2026 17:04
Join the list[str] update_command with spaces before interpolating
into the user-facing message, so it displays as a shell command
rather than a Python repr like ['python', '-m', 'pip', ...].

Co-authored-by: Lucain <Wauplin@users.noreply.github.com>
@Wauplin Wauplin changed the title [CLI] Add hf upgrade + drop interactive update prompt [CLI] Add hf update + drop interactive update prompt Apr 22, 2026
Copy link
Copy Markdown
Collaborator Author

@Wauplin Wauplin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✔️

@Wauplin Wauplin requested a review from hanouticelina April 22, 2026 15:30
@julien-c
Copy link
Copy Markdown
Member

Sounds reasonable.

Copy link
Copy Markdown
Collaborator

@hanouticelina hanouticelina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it works and looks good to me! thanks 👍

@Wauplin Wauplin merged commit 3017d4a into main Apr 27, 2026
10 of 20 checks passed
@Wauplin Wauplin deleted the cli-upgrade-command branch April 27, 2026 11:13
@huggingface-hub-bot
Copy link
Copy Markdown
Contributor

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

if returncode != 0:
raise typer.Exit(code=returncode)
out.hint(
"You may also want to run `hf skills upgrade` to refresh any installed skills "
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe should be update for consistency

hanouticelina added a commit that referenced this pull request Apr 30, 2026
Per Julien's feedback in #4131. No backward compat alias kept.
hanouticelina added a commit that referenced this pull request Apr 30, 2026
Per Julien's feedback in #4131. No backward compat alias kept.
hanouticelina added a commit that referenced this pull request Apr 30, 2026
Per Julien's feedback in #4131. No backward compat alias kept.
Wauplin pushed a commit that referenced this pull request May 4, 2026
Per Julien's feedback in #4131. No backward-compat alias kept.
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.

4 participants