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 settings for creating and duplicating spaces #1625

Conversation

martinbrose
Copy link
Contributor

References #1457

Key Features

  • Modifies hf_api.py to add space-related settings to create_repo.
  • Modifies hf_api.py to add additional settings to duplicate_space.

@martinbrose
Copy link
Contributor Author

I tried to come up with tests for duplicating spaces.
But tbh, I don't think I have the best approach. I'm getting account rate-limited.
So I believe I'm a little bit too resource-hungry with the test case.

I'll probably leave this with you @Wauplin if you don't mind. You probably have the best idea of how to mock this...

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.

That's a very good quality PR, thanks for the work @martinbrose ! I have added comments about renaming/slightly rephrasing but that's it. About the duplicate_space tests, I think you can use the exact same approach as the mocked create_repo tests. With mock tests you cannot be rate-limited since http requests are not made to the Hub. I'm fine with adding them myself if you prefer.

Also to complete this PR, would you mind updating the Manage your Space guide in the docs? You can update them in the docs/ folder. There is a section in a guide "Bonus: request hardware when creating the Space!". I would update it to show how to set hardware + sleep time + secrets + variables at the same time at repo creation. There is also a guide for duplicating Spaces that would benefit from a mention of the new arguments you've added. I would keep the existing minimal example and a another complete example just below and explain in a few words why it's useful. Let me know what you think.

Thanks in advance!

src/huggingface_hub/hf_api.py Outdated Show resolved Hide resolved
src/huggingface_hub/hf_api.py Outdated Show resolved Hide resolved
src/huggingface_hub/hf_api.py Outdated Show resolved Hide resolved
src/huggingface_hub/hf_api.py Show resolved Hide resolved
src/huggingface_hub/hf_api.py Outdated Show resolved Hide resolved
src/huggingface_hub/hf_api.py Outdated Show resolved Hide resolved
src/huggingface_hub/hf_api.py Outdated Show resolved Hide resolved
@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Aug 30, 2023

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

@martinbrose
Copy link
Contributor Author

Thanks for the review and the kind recognition.

I addressed all the code review points and added the documentation.
I'll work on the duplication test cases in the next few days.

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.

Nice improvement in the docs! Waiting for the final tests for duplicate_space before merging :)

@martinbrose
Copy link
Contributor Author

Hi @Wauplin, I think I was overthinking the test case... we are only testing if the API call is correct.

This is now addressed in the additional test case.

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.

Great job @martinbrose! Thanks for the last test, it's perfect like this. The PR is fine to merge now :) 🔥

@Wauplin Wauplin merged commit dfc9bcb into huggingface:main Sep 4, 2023
13 of 14 checks passed
@martinbrose martinbrose deleted the 1457-additional-settings-for-duplicating-repos branch September 4, 2023 10:00
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.

3 participants