huggingface_hub: Repository does not work with Spaces

If I create a space and then do

repo = Repository(local_dir=local_dir, clone_from="https://huggingface.co/space/osanseviero/this-is-a-test12345", repo_type="space")

I get following error

ValueError: No space_sdk provided. create_repo expects space_sdk to be one of [‘gradio’, ‘streamlit’, ‘static’] when repo_type is ‘space’`

cc @nateraw @LysandreJik @muellerzr

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 17 (17 by maintainers)

Most upvoted comments

Actually with spaces it also fails.

I tried to debug a bit more. It fails when I’m the owner of the space and works when it’s another unrelated space

@muellerzr would you like to work together on this? maybe have a meet?

Even if I think that Repository’s ability to create a repository on the fly reduces the mental load, I understand that it can be a bit weird and that it can be surprising. However, I’d rather we have one way of doing things rather than several methods which do a very similar thing.

If everyone thinks that Repository shouldn’t create the repo on the fly, then IMO we should remove the repo creation and push create_repo, but not Repository.create.

I personally think Repository.create(...) -> Repository is as ambiguous as Repository(..., clone_from="xxx") creating the xxx repository remotely; but create_repo(...); Repository(..., clone_from="xxx") is not ambiguous.

isn’t it weird API-wise that Repository’s init creates a repo for you on the fly if needed?

Shouldn’t it be a different method to better separate intents, like a static Repository.create(...) -> Repository?