Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose repo security status field in ModelInfo #2639

Merged
merged 4 commits into from
Oct 28, 2024

Conversation

hanouticelina
Copy link
Contributor

@hanouticelina hanouticelina commented Oct 28, 2024

Previously, the API response of https://huggingface.co/api/models/{repo_id}?securityStatus=true included repo security data in in the securityStatus field. This field was renamed to securityRepoStatus recently on server side, leading to issue reports huggingface/Google-Cloud-Containers#116 & #2638. However, this field wasn't explicitly exposed in ModelInfo. This PR adds it as a field in the dataclass.

Changes made

  • Add and document security_repo_status field to ModelInfo dataclass. This field will contain the value returned by the API in securityRepoStatus key.
  • Update model_info()'s securityStatus argument to clarify that the security status will be returned in ModelInfo.security_repo_status.
  • Update related test.

@Wauplin I'm not sure if it's a good idea to remove securityRepoStatus from the dict (here), this will implicitly "break" things again since users might be using this key already. what do you think?

@hanouticelina hanouticelina requested a review from Wauplin October 28, 2024 11:08
@HuggingFaceDocBuilderDev

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.

Copy link
Contributor

@Wauplin Wauplin left a comment

Choose a reason for hiding this comment

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

Looks good!

tests/test_hf_api.py Outdated Show resolved Hide resolved
src/huggingface_hub/hf_api.py Show resolved Hide resolved
@hanouticelina hanouticelina merged commit 01bdce3 into main Oct 28, 2024
17 checks passed
@hanouticelina hanouticelina deleted the add-repo-security-status-field branch October 28, 2024 14:27
hanouticelina added a commit that referenced this pull request Oct 28, 2024
* expose repo security status in ModelInfo

* remove warning in test
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.

4 participants