Skip to content

Commit 0b5993e

Browse files
Wauplinhanouticelina
authored andcommitted
Remove huggingface-cli entirely in favor of hf (#3404)
* Remove huggingface-cli entirely in favor of hf * dup
1 parent 617016b commit 0b5993e

23 files changed

+117
-2833
lines changed

setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ def get_version() -> str:
131131
extras_require=extras,
132132
entry_points={
133133
"console_scripts": [
134-
"huggingface-cli=huggingface_hub.commands.huggingface_cli:main",
135134
"hf=huggingface_hub.cli.hf:main",
136135
"tiny-agents=huggingface_hub.inference._mcp.cli:app",
137136
],

src/huggingface_hub/_login.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from typing import Optional
2121

2222
from . import constants
23-
from .commands._cli_utils import ANSI
23+
from .cli._cli_utils import ANSI
2424
from .utils import (
2525
capture_output,
2626
get_token,
@@ -244,7 +244,7 @@ def interpreter_login(*, skip_if_logged_in: bool = False) -> None:
244244
logger.info("User is already logged in.")
245245
return
246246

247-
from .commands.delete_cache import _ask_for_confirmation_no_tui
247+
from .cli.cache import _ask_for_confirmation_no_tui
248248

249249
print(_HF_LOGO_ASCII)
250250
if get_token() is not None:

src/huggingface_hub/cli/_cli_utils.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,23 @@
1515

1616
import os
1717
from enum import Enum
18-
from typing import Annotated, Optional, Union
18+
from typing import TYPE_CHECKING, Annotated, Optional, Union
1919

2020
import click
2121
import typer
2222

2323
from huggingface_hub import __version__
24-
from huggingface_hub.hf_api import HfApi
24+
25+
26+
if TYPE_CHECKING:
27+
from huggingface_hub.hf_api import HfApi
28+
29+
30+
def get_hf_api(token: Optional[str] = None) -> "HfApi":
31+
# Import here to avoid circular import
32+
from huggingface_hub.hf_api import HfApi
33+
34+
return HfApi(token=token, library_name="hf", library_version=__version__)
2535

2636

2737
class ANSI:
@@ -140,7 +150,3 @@ class RepoType(str, Enum):
140150
help="Git revision id which can be a branch name, a tag, or a commit hash.",
141151
),
142152
]
143-
144-
145-
def get_hf_api(token: Optional[str] = None) -> HfApi:
146-
return HfApi(token=token, library_name="hf", library_version=__version__)

src/huggingface_hub/commands/__init__.py

Lines changed: 0 additions & 27 deletions
This file was deleted.

src/huggingface_hub/commands/_cli_utils.py

Lines changed: 0 additions & 74 deletions
This file was deleted.

0 commit comments

Comments
 (0)