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

Add list_repo_likers method to HfApi #1715

Merged
merged 5 commits into from
Oct 6, 2023

Conversation

issamarabi
Copy link
Contributor

@issamarabi issamarabi commented Oct 5, 2023

Summary

This PR introduces the list_repo_likers method to the HfApi class, allowing users to retrieve a list of likers for a given model repository on the Hugging Face Hub.

Changes

  • Implemented list_repo_likers method in HfApi.
  • Added corresponding dataclass User to represent users who liked a repo.
  • Integrated a new API endpoint to fetch likers for a given model repository.
  • Added unit tests to ensure the correctness of the method.

Motivation

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.

Very clean and complete PR, thanks @issamarabi! I added 2 minor comments but overall looks good. 🎉

src/huggingface_hub/hf_api.py Outdated Show resolved Hide resolved
issamarabi and others added 2 commits October 5, 2023 12:32
Co-authored-by: Lucain <lucainp@gmail.com>
Co-authored-by: Lucain <lucainp@gmail.com>
@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Oct 5, 2023

The documentation is not available anymore as the PR was closed or merged.

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.

Hey @issamarabi thanks for making the changes! I re-reviewed and tested it locally. I hope you don't mind, I pushed a commit to your branch to:

  • apply formatting (run make style)
  • add User object to the docs (I forgot to mention it)
  • add User and list_repo_likers at root level. This makes them usable without intanciating HfApi yourself
  • fix an attribute name

I think we are good to merge now. Great addition!

@codecov
Copy link

codecov bot commented Oct 6, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (5d2d297) 82.42% compared to head (9246cf8) 82.01%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1715      +/-   ##
==========================================
- Coverage   82.42%   82.01%   -0.42%     
==========================================
  Files          62       62              
  Lines        7244     7260      +16     
==========================================
- Hits         5971     5954      -17     
- Misses       1273     1306      +33     
Files Coverage Δ
src/huggingface_hub/__init__.py 75.75% <ø> (ø)
src/huggingface_hub/hf_api.py 84.73% <100.00%> (-1.67%) ⬇️

... and 3 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Wauplin Wauplin merged commit 35117fb into huggingface:main Oct 6, 2023
14 checks passed
@julien-c
Copy link
Member

julien-c commented Oct 6, 2023

awesome job @issamarabi 🔥

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.

Return the liked users for for a huggingface model
4 participants