Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/source/en/guides/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ The `huggingface_hub` Python package comes with a built-in CLI called `hf`. This
First of all, let's install the CLI:

```
>>> pip install -U "huggingface_hub[cli]"
>>> pip install -U "huggingface_hub"
```

> [!TIP]
> In the snippet above, we also installed the `[cli]` extra dependencies to make the user experience better, especially when using the `cache delete` command.
> The CLI ships with the core `huggingface_hub` package.

Alternatively, you can install the `hf` CLI with a single command:

Expand Down Expand Up @@ -78,7 +78,7 @@ Make sure uv is installed (adds `uv` and `uvx` to your PATH):
Then install the CLI globally and use it anywhere:

```bash
>>> uv tool install "huggingface_hub[cli]"
>>> uv tool install "huggingface_hub"
>>> hf auth whoami
```

Expand Down
6 changes: 3 additions & 3 deletions docs/source/ko/guides/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ rendered properly in your Markdown viewer.
먼저, CLI를 설치해 보세요:

```
>>> pip install -U "huggingface_hub[cli]"
>>> pip install -U "huggingface_hub"
```

> [!TIP]
> 위의 코드에서 사용자 경험을 높이기 위해 `[cli]` 추가 종속성을 포함하였습니다. 이는 `cache delete` 명령을 사용할 때 특히 유용합니다.
> CLI는 기본 `huggingface_hub` 패키지에 포함되어 있습니다.

설치가 완료되면, CLI가 올바르게 설정되었는지 확인할 수 있습니다:

Expand Down Expand Up @@ -59,7 +59,7 @@ CLI가 제대로 설치되었다면 CLI에서 사용 가능한 모든 옵션 목
영구적으로 도구를 설치해 어디에서나 사용하려면:

```bash
>>> uv tool install "huggingface_hub[cli]"
>>> uv tool install "huggingface_hub"
>>> hf --help
```

Expand Down
9 changes: 2 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,12 @@ def get_version() -> str:
"httpx>=0.23.0, <1",
"tqdm>=4.42.1",
"typer-slim",
"shellingham",
"typing-extensions>=3.7.4.3", # to be able to import TypeAlias
]

extras = {}

extras["cli"] = [
"InquirerPy==0.3.4", # Note: installs `prompt-toolkit` in the background
"shellingham",
]

extras["inference"] = [
"aiohttp", # for AsyncInferenceClient
]
Expand Down Expand Up @@ -64,8 +60,7 @@ def get_version() -> str:
] + extras["inference"]

extras["testing"] = (
extras["cli"]
+ extras["inference"]
extras["inference"]
+ extras["oauth"]
+ [
"jedi",
Expand Down
19 changes: 0 additions & 19 deletions src/huggingface_hub/cli/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,6 @@

logger = logging.get_logger(__name__)

try:
from InquirerPy import inquirer
from InquirerPy.base.control import Choice

_inquirer_py_available = True
except ImportError:
_inquirer_py_available = False


auth_cli = typer_factory(help="Manage authentication (login, logout, etc.).")

Expand Down Expand Up @@ -89,17 +81,6 @@ def _select_token_name() -> Optional[str]:
logger.error("No stored tokens found. Please login first.")
return None

if _inquirer_py_available:
choices = [Choice(token_name, name=token_name) for token_name in token_names]
try:
return inquirer.select(
message="Select a token to switch to:",
choices=choices,
default=None,
).execute()
except KeyboardInterrupt:
logger.info("Token selection cancelled.")
return None
# if inquirer is not available, use a simpler terminal UI
print("Available stored tokens:")
for i, token_name in enumerate(token_names, 1):
Expand Down
12 changes: 6 additions & 6 deletions utils/installers/install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
Installs the Hugging Face CLI on Windows by creating an isolated virtual environment and exposing the `hf` command.

.DESCRIPTION
Downloads and installs the `huggingface_hub[cli]` package into a dedicated virtual environment, then copies the generated `hf.exe` console script to a directory on the user's PATH.
Downloads and installs the `huggingface_hub` package into a dedicated virtual environment, then copies the generated `hf.exe` console script to a directory on the user's PATH.

.PARAMETER Force
Recreates the virtual environment even if it already exists. Off by default.
Expand Down Expand Up @@ -235,13 +235,13 @@ function New-VirtualEnvironment {
}

function Install-HuggingFaceHub {
$packageSpec = 'huggingface_hub[cli]'
$packageSpec = 'huggingface_hub'
$requestedVersion = $env:HF_CLI_VERSION
if ($requestedVersion) {
$packageSpec = "huggingface_hub[cli]==$requestedVersion"
Write-Log "Installing huggingface_hub[cli] (version $requestedVersion)..."
$packageSpec = "huggingface_hub==$requestedVersion"
Write-Log "Installing The Hugging Face CLI (version $requestedVersion)..."
} else {
Write-Log "Installing huggingface_hub[cli] (latest)..."
Write-Log "Installing The Hugging Face CLI (latest)..."
}
if (-not $script:VenvPython) { $script:VenvPython = Join-Path $SCRIPTS_DIR "python.exe" }

Expand All @@ -267,7 +267,7 @@ function Publish-HfCommand {

$hfExeSource = Join-Path $SCRIPTS_DIR "hf.exe"
if (-not (Test-Path $hfExeSource)) {
throw "hf.exe not found in virtual environment. Check that huggingface_hub[cli] installed correctly."
throw "hf.exe not found in virtual environment. Check that The Hugging Face CLI installed correctly."
}

$hfExeTarget = Join-Path $BIN_DIR "hf.exe"
Expand Down
10 changes: 5 additions & 5 deletions utils/installers/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -278,12 +278,12 @@ create_venv() {

# Install huggingface_hub with CLI extras
install_hf_hub() {
local package_spec="huggingface_hub[cli]"
local package_spec="huggingface_hub"
if [ -n "$REQUESTED_VERSION" ]; then
package_spec="huggingface_hub[cli]==$REQUESTED_VERSION"
log_info "Installing huggingface_hub[cli] (version $REQUESTED_VERSION)..."
package_spec="huggingface_hub==$REQUESTED_VERSION"
log_info "Installing The Hugging Face CLI (version $REQUESTED_VERSION)..."
else
log_info "Installing huggingface_hub[cli] (latest)..."
log_info "Installing The Hugging Face CLI (latest)..."
fi

local extra_pip_args="${HF_CLI_PIP_ARGS:-${HF_PIP_ARGS:-}}"
Expand Down Expand Up @@ -318,7 +318,7 @@ expose_cli_command() {
local source_cli="$VENV_DIR/bin/hf"
if [ ! -x "$source_cli" ]; then
log_error "hf command not found in the virtual environment at $source_cli"
log_error "Verify that huggingface_hub[cli] installed correctly."
log_error "Verify that The Hugging Face CLI is installed correctly."
exit 1
fi

Expand Down
Loading