-
Notifications
You must be signed in to change notification settings - Fork 571
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
Manage access requests programmatically #1905
Conversation
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's awesome! Very cool API.
Is it worth mentioning what kind of permissions they'll need on the repo to have access to the accepted/pending/rejected requests (is it read/write/admin?)? Especially given the example is Llama-2-7b.
Thanks both for the review! I have addressed your comments. @LysandreJik regarding roles in organization, the user must have "write" or "admin" role. I have updated the docstrings accordingly. (fyi, role I'll wait for the CI to pass and then merge this! |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #1905 +/- ##
==========================================
+ Coverage 82.25% 82.31% +0.06%
==========================================
Files 65 65
Lines 8029 8087 +58
==========================================
+ Hits 6604 6657 +53
- Misses 1425 1430 +5 ☔ View full report in Codecov by Sentry. |
@lappemic @Wauplin has something changed here in the last days? After April 18th, my automations querying access seem to have stopped working. Curl requests like this:
seem not to be working any more |
@RonanKMcGovern shouldn't be the case no. If you are getting errors, could you open a new ticket and provide more context (requests/script + error message + stacktrace if applicable). Thanks in advance! |
Ah very sorry @Wauplin , I just realised I rolled my HF token after a live stream last week without realising it was being used in some automations. Thanks for the quick reply. |
Glad your issue's solved then! |
Solves #1535.
Let's add official support to programmatically manage access requests for gated repos.
The API defines a
AccessRequest
dataclass with username, email, status, timestamp and fields + 7 endpoints. I reused as much as possible the vocabulary used in the UI. We have:list_pending_access_requests
=> returns "pending" listlist_accepted_access_requests
=> returns "accepted" listlist_rejected_access_requests
=> returns "rejected" listcancel_access_request
=> moves request to "pending" listaccept_access_request
=> moves request to "accepted" listreject_access_request
=> moves request to "rejected" listgrant_access
=> add a user to "accepted" list (the user doesn't have to request access first)Methods docstrings are documented with examples. I don't think it's worth creating a guide dedicated to it in
huggingface_hub
as it would be quite redundant with the Hub docs already. I suggest to update the Hub docs instead to mention thehuggingface_hub
implementation but that's it.TODO: