Skip to content

Commit ea5051f

Browse files
hanouticelinaWauplin
authored andcommitted
[CLI ]Improving a bit hf CLI discoverability (#4079)
* Re-add huggingface-cli as a deprecation notice * hints
1 parent f86e165 commit ea5051f

2 files changed

Lines changed: 36 additions & 0 deletions

File tree

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ def get_version() -> str:
115115
entry_points={
116116
"console_scripts": [
117117
"hf=huggingface_hub.cli.hf:main",
118+
"huggingface-cli=huggingface_hub.cli.deprecated_cli:main",
118119
"tiny-agents=huggingface_hub.inference._mcp.cli:app",
119120
],
120121
"fsspec.specs": "hf=huggingface_hub.HfFileSystem",
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
"""Deprecated `huggingface-cli` entry point. Warns and exits."""
2+
3+
import shutil
4+
import sys
5+
6+
from ._output import out
7+
8+
9+
def main() -> None:
10+
out.warning("`huggingface-cli` is deprecated and no longer works. Use `hf` instead.\n")
11+
12+
if shutil.which("hf"):
13+
from huggingface_hub.cli._cli_utils import check_cli_update
14+
15+
check_cli_update("huggingface_hub")
16+
out.hint("`hf` is already installed! Use it directly.\n")
17+
else:
18+
out.hint(
19+
"Install `hf`:\n"
20+
" Standalone (recommended): curl -LsSf https://hf.co/cli/install.sh | bash\n"
21+
" Using Homebrew: brew install hf\n"
22+
" Using pip: pip install huggingface_hub\n",
23+
)
24+
25+
out.hint(
26+
"Examples:\n"
27+
" hf auth login\n"
28+
" hf download unsloth/gemma-4-31B-it-GGUF\n"
29+
" hf upload my-cool-model . .\n"
30+
' hf models ls --search "gemma"\n'
31+
" hf repos ls --format json\n"
32+
" hf jobs run python:3.12 python -c 'print(\"Hello!\")'\n"
33+
" hf --help\n",
34+
)
35+
sys.exit(1)

0 commit comments

Comments
 (0)