-
Notifications
You must be signed in to change notification settings - Fork 570
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
🗑 Deprecate token
in read-only methods of HfApi
in favor of use_auth_token
#928
Conversation
The documentation is not available anymore as the PR was closed or merged. |
I'd say adding Related: #837 It would also be nice to let users pass token to a |
+1 for keeping |
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.
i agree that it would be good to have consistency (and we shouldn't have introduced two different names in the first place)
I do not really mind whether it's called use_auth_token
or token
, though
Agree with team members above on |
Thinking more on it, I think it's better to align everything to I think the benefit of renaming to a "better" param name is too small compared to the breakage in downstream libraries i.e., I support @SBrandeis's PR here EDIT following discussion with @LysandreJik: PR is cool because it's for read-only methods. |
Across libraries there seems to be a general tendency to have To that end, if you feel strongly, I'm fine with going forward with this PR as it adds the |
cc @Wauplin |
Coming a bit after the battle but I would also have been for a unique Quick question: is there a chance that a request that is today "public" become "private" (token required) in the future or the opposite ? If yes, having a single parameter name would avoid to handle a name change in In any case, I get the "it is as it is and vastly used already so let's keep both"-argument. It's a pretty strong argument in favor of this PR 😄 EDIT(side note): what I found confusing in the current naming is that |
Just an update on this PR. I think there is kind of a consensus on moving forward to merge it. The rule will be "use That said, next steps are:
@SBrandeis if you'd like I can take care of it. I just need the permissions to push commits on your fork. |
98677f4
to
9fb5886
Compare
This PR deprecates the `token` argument in read-only methods of `HfApi` in favor of `use_auth_token`. `use_auth_token` is more flexible as it allows not passing a token, whereas `token=None` fetches the token from `HfFolder`. I personally prefer the semantics of `use_auth_token`, that I find very legible: - `use_auth_token=False` - `use_auth_token="token"` - `use_auth_token=True` cc @lhoestq
9fb5886
to
32faaaa
Compare
888d598
to
b66ed3d
Compare
use_auth_token
for read only HfApi
methodstoken
in read-only methods of HfApi
in favor of use_auth_token
token
in read-only methods of HfApi
in favor of use_auth_token
token
in read-only methods of HfApi
in favor of use_auth_token
b793920
to
c4dd8ea
Compare
c4dd8ea
to
4bad3fd
Compare
Codecov Report
@@ Coverage Diff @@
## main #928 +/- ##
==========================================
+ Coverage 83.53% 83.58% +0.05%
==========================================
Files 37 37
Lines 3918 3930 +12
==========================================
+ Hits 3273 3285 +12
Misses 645 645
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
This PR deprecates the
token
argument in read-only methods ofHfApi
in favor ofuse_auth_token
.use_auth_token
is more flexible as it allows not passing a token, whereastoken=None
fetches the token fromHfFolder
.I personally prefer the semantics of
use_auth_token
, that I find very legible:use_auth_token=False
use_auth_token="token"
use_auth_token=True
cc @lhoestq