huggingface_hub
Globally set git credential.helper to `store` in google colab
#1053
Merged

Globally set git credential.helper to `store` in google colab #1053

Wauplin merged 12 commits into main from 1043-remove-warning-in-google-colab
Wauplin
Wauplin2 years ago

Fix warning message as discussed in #1043 (#1043 (comment))

Now if huggingface_hub detects that it runs in a google colab, git config --global credential.helper store is ran by default without warning message to ask the user to do it.

Here is a Google Colab to test it.

(cc @apolinario)

Wauplin Globally set credential.helper to store in google colab
b893eaea
Wauplin messy mess
4dbe56e2
Wauplin fix messy mess
e8849937
Wauplin forgot return
28f6a9b3
Wauplin more mess
c376bc04
Wauplin how to debug this ?
8196aee3
Wauplin tmp
659bae8f
Wauplin more logs
49433501
Wauplin stop been stupid
ed691de2
Wauplin maybe fixed ?
707596db
Wauplin Everything back to normal :)
799b615c
Wauplin Wauplin requested a review from julien-c julien-c 2 years ago
Wauplin Wauplin requested a review from osanseviero osanseviero 2 years ago
Wauplin Wauplin requested a review from LysandreJik LysandreJik 2 years ago
Wauplin
Wauplin2 years ago

Lots of commit to tests in the notebook but works fine now 😁

HuggingFaceDocBuilderDev
HuggingFaceDocBuilderDev2 years ago (edited 2 years ago)

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

osanseviero
osanseviero approved these changes on 2022-09-15
osanseviero2 years ago

Very cool, thanks!

Conversation is marked as resolved
Show resolved
src/huggingface_hub/commands/user.py
342def _set_store_as_git_credential_helper_globally() -> None:
343 """Set globally the credential.helper to `store`.
344
345
To be used only in Google Colab as we assume the user don't care about the git
osanseviero2 years ago
Suggested change
To be used only in Google Colab as we assume the user don't care about the git
To be used only in Google Colab as we assume the user doesn't care about the git
Wauplin
Wauplin commented on 2022-09-15
Conversation is marked as resolved
Show resolved
src/huggingface_hub/utils/_subprocess.py
3131 please call `subprocess.run` manually in case you would like for them not to
3232 be captured.
3333
3434
Args:
35
command (`List[str]`):
36
The command to execute as a list of strings.
37
folder (`str`):
38
The folder in which to run the command.
35
command (`str` or `List[str]`):
36
The command to execute as a string or list of strings.
37
folder (`str`, *optional*):
38
The folder in which to run the command. Defaults to current working
39
directory (from `os.getcwd()`).
Wauplin2 years ago

@LysandreJik I slightly updated the run_subprocess util to make it less verbose when making a simple call. Please let me know if that could cause a problem in your opinion ? (asking since I removed a ValueError that was explicitly introduced so maybe for a good reason :) )

LysandreJik2 years ago

No, that works well for me!

Wauplin2 years ago

great, thanks for confirmation :)

Wauplin Update src/huggingface_hub/commands/user.py
c849d6b5
codecov
codecov2 years ago

Codecov Report

Merging #1053 (c849d6b) into main (7dee38c) will decrease coverage by 0.00%.
The diff coverage is 78.57%.

@@            Coverage Diff             @@
##             main    #1053      +/-   ##
==========================================
- Coverage   83.79%   83.79%   -0.01%     
==========================================
  Files          37       37              
  Lines        3956     3968      +12     
==========================================
+ Hits         3315     3325      +10     
- Misses        641      643       +2     
Impacted Files Coverage Δ
src/huggingface_hub/commands/user.py 33.12% <72.72%> (+2.98%) ⬆️
src/huggingface_hub/utils/_subprocess.py 100.00% <100.00%> (+12.50%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

LysandreJik
LysandreJik approved these changes on 2022-09-15
LysandreJik2 years ago

Great, thank you for this change @Wauplin

Wauplin Wauplin merged c4e008a5 into main 2 years ago
Wauplin Wauplin deleted the 1043-remove-warning-in-google-colab branch 2 years ago

Login to write a write a comment.

Login via GitHub

Assignees
No one assigned
Labels
Milestone