[CLI] Migrate extensions, lfs-enable-largefiles, version to out singleton#4284
Merged
Merged
Conversation
…n` to `out`
- `lfs_enable_largefiles` → `out.result("Local repo set up for largefiles", path=...)`
- `extensions install` → structured `out.result(... source=..., command=...)`
+ `out.hint("Run it with: hf <name>")` for the actionable follow-up.
- `extensions remove` → `out.result("Extension removed", name=...)`.
- `hf version` (the subcommand) → `out.result("hf version", version=...)`. The
global `--version` flag in `hf.py` keeps a raw `print` because it fires as an
eager typer callback before `out` is wired up.
Wauplin
approved these changes
May 27, 2026
Wauplin
left a comment
Collaborator
There was a problem hiding this comment.
Last commands to migrate? 🙌
|
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. |
Collaborator
Author
yes! |
Contributor
|
This PR has been shipped as part of the v1.17.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.
Part of #3979. Migrates the last few stragglers that still used
print()directly:hf extensions install,hf extensions remove,hf lfs-enable-largefiles, andhf version.hf extensions install→out.result("<Type> extension installed", source=..., command=...)+ anout.hint("Run it with: hf <name>")for the follow-up.hf extensions remove→out.result("Extension removed", name=...).hf lfs-enable-largefiles→out.result("Local repo set up for largefiles", path=...).hf version(the subcommand) →out.result("hf version", version=...). The global--versionflag inhf.pykeeps its rawprint(__version__)because it fires as an eager Typer callback beforeoutis set up.hf extensions lsandhf extensions searchwere already migrated in #4057 — this PR just cleans up the leftover write paths in the same module.Examples
Note
Low Risk
Output-only changes with no behavior to auth, uploads, or extension install logic beyond formatting.
Overview
Finishes the CLI output migration (#3979) by replacing the last direct
print()calls inextensions,lfs-enable-largefiles, and theversionsubcommand with the sharedouthelpers.hf extensions installnow reports success viaout.result(type, source, command) and usesout.hintfor the run command.hf extensions removeandhf lfs-enable-largefilesuseout.resultwith structured fields.hf versionprints throughout.resultso--format(json, quiet, agent) works like other commands; the global--versionflag is unchanged and still prints raw text beforeoutis initialized.Reviewed by Cursor Bugbot for commit d8cceae. Configure here.