Skip to content

Commit c350eed

Browse files
authored
Make 'name' optional in catalog deploy (#3529)
* Make 'name' optional in catalog deploy * doc
1 parent 43d2b31 commit c350eed

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

docs/source/en/package_reference/cli.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -328,16 +328,13 @@ Deploy an Inference Endpoint from the Model Catalog.
328328
**Usage**:
329329

330330
```console
331-
$ hf endpoints catalog deploy [OPTIONS] NAME
331+
$ hf endpoints catalog deploy [OPTIONS]
332332
```
333333

334-
**Arguments**:
335-
336-
* `NAME`: Endpoint name. [required]
337-
338334
**Options**:
339335

340336
* `--repo TEXT`: The name of the model repository associated with the Inference Endpoint (e.g. 'openai/gpt-oss-120b'). [required]
337+
* `--name TEXT`: Endpoint name.
341338
* `--namespace TEXT`: The namespace associated with the Inference Endpoint. Defaults to the current user's namespace.
342339
* `--token TEXT`: A User Access Token generated from https://huggingface.co/settings/tokens.
343340
* `--help`: Show this message and exit.

src/huggingface_hub/cli/inference_endpoints.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919
str,
2020
typer.Argument(help="Endpoint name."),
2121
]
22+
NameOpt = Annotated[
23+
Optional[str],
24+
typer.Option(help="Endpoint name."),
25+
]
2226

2327
NamespaceOpt = Annotated[
2428
Optional[str],
@@ -130,13 +134,13 @@ def deploy(
130134

131135
@catalog_app.command(name="deploy")
132136
def deploy_from_catalog(
133-
name: NameArg,
134137
repo: Annotated[
135138
str,
136139
typer.Option(
137140
help="The name of the model repository associated with the Inference Endpoint (e.g. 'openai/gpt-oss-120b').",
138141
),
139142
],
143+
name: NameOpt = None,
140144
namespace: NamespaceOpt = None,
141145
token: TokenOpt = None,
142146
) -> None:

tests/test_cli.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1344,7 +1344,6 @@ def test_deploy_from_catalog(self, runner: CliRunner) -> None:
13441344
"endpoints",
13451345
"catalog",
13461346
"deploy",
1347-
"catalog-endpoint",
13481347
"--repo",
13491348
"catalog/model",
13501349
],
@@ -1353,7 +1352,7 @@ def test_deploy_from_catalog(self, runner: CliRunner) -> None:
13531352
api_cls.assert_called_once_with(token=None)
13541353
api.create_inference_endpoint_from_catalog.assert_called_once_with(
13551354
repo_id="catalog/model",
1356-
name="catalog-endpoint",
1355+
name=None,
13571356
namespace=None,
13581357
token=None,
13591358
)

0 commit comments

Comments
 (0)