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
Fix HfApi.create_repo when repo_type is 'space' #394
Conversation
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.
Great find! Thanks a lot
Also requesting reviews from @cbensimon and @Pierrci re. the server/API side of this |
Just noticed the CLI is broken as well - let's include that fix in this PR as well. |
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.
Looks good to me from the perspective of hfh
! Very clean tests, thanks for working on it!
52f87dc
to
1f36461
Compare
src/huggingface_hub/hf_api.py
Outdated
@@ -821,7 +846,8 @@ def update_repo_visibility( | |||
path_prefix += REPO_TYPES_URL_PREFIXES[repo_type] | |||
|
|||
path = "{}{}/{}/settings".format(path_prefix, namespace, name) | |||
json = {"private": private} | |||
# HACK - hard coded recently added 'gated' param for now. Decide how to deal with this in the future. | |||
json = {"private": private, "gated": False} |
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.
@SBrandeis Repo updates fail if gated
is not included as a parameter. Saw this was added recently, so just hardcoded False
for now. Is that ok?
Referring to moon-landing PR: https://github.com/huggingface/moon-landing/pull/1316
CC @julien-c
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.
API endpoint should probably default to false server-side, @SBrandeis
Does this currently break all repo creation from hf_api, @nateraw? not just spaces, right?
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.
Oh actually its only failing for spaces. Can update accordingly here for now
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.
very weird, but good to hear that =)
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.
all done 😄
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.
Super weird that's it's failing only for spaces 🤔
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.
In the meantime, you can also test in production by adding the @with_production_testing
decorator to your tests. These will run on the production server instead of the staging, so can be helpful while spaces are unavailable on staging.
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.
not a great idea in my opinion, but we've just updated the staging env so should might work OTB now
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.
Production tests are better than no tests :) if the staging is available, then that's definitely the way to go.
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.
@LysandreJik , after this convo earlier, we got the staging endpoint working 😀. All good!
Resolves #393
Can't get local tests to work on staging endpoint, but when I switch the code to use the public endpoint + my personal token, the tests run just fine! They're skipped here since spaces is still in beta.