Skip to content

Deprecate model_name in favor of search in list_models#4112

Merged
Wauplin merged 4 commits intomainfrom
deprecate-model-name-in-list-models
Apr 15, 2026
Merged

Deprecate model_name in favor of search in list_models#4112
Wauplin merged 4 commits intomainfrom
deprecate-model-name-in-list-models

Conversation

@Wauplin
Copy link
Copy Markdown
Contributor

@Wauplin Wauplin commented Apr 15, 2026

list_models(..., search="...") and list_models(..., model_name="...") are strictly equivalent in the code (both are passed as ?search=... query in the API call. This PR deprecates model_name in favor of search, with a deprecation cycle until 2.0 (it's low prio anyway).

This PR doesn't impact the CLI since hf models list only accepts --search.

cc @julien-c who pinged me about it


Note

Low Risk
Low risk: change is limited to adding a deprecation warning and updating tests, without altering the underlying query parameters sent to the Hub.

Overview
HfApi.list_models now marks the model_name argument as deprecated (via _deprecate_arguments, removal targeted for 2.0) and updates the docstring to direct users to search.

Tests are adjusted to use search instead of model_name when filtering models, keeping coverage aligned with the new preferred API.

Reviewed by Cursor Bugbot for commit 4cb3b6d. Bugbot is set up for automated code reviews on this repo. Configure here.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 723bdf9. Configure here.

Comment thread src/huggingface_hub/hf_api.py
@bot-ci-comment
Copy link
Copy Markdown

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.

@Wauplin Wauplin merged commit 26d7886 into main Apr 15, 2026
19 of 21 checks passed
@Wauplin Wauplin deleted the deprecate-model-name-in-list-models branch April 15, 2026 17:31
@huggingface-hub-bot
Copy link
Copy Markdown
Contributor

This PR has been shipped as part of the v1.11.0 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants