huggingface / huggingface_hub

The official Python client for the Huggingface Hub.
https://huggingface.co/docs/huggingface_hub
Apache License 2.0
1.98k stars 516 forks source link

Shell completions #1197

Open Freed-Wu opened 1 year ago

Freed-Wu commented 1 year ago

Is your feature request related to a problem? Please describe. Add shell completions for huggingface-cli

Describe the solution you'd like https://docs.iterative.ai/shtab Describe alternatives you've considered https://docs.iterative.ai/shtab/#alternatives

Wauplin commented 1 year ago

Hi @Freed-Wu, thanks for the idea. Seems a good suggestion to facilitate user experience. However I don't have experience in it. Would you mind implementing a POC to show how this would integrate with huggingface-cli and make a PR for it ?

Something we should keep it mind is that installing shtab (or argcomplete) should be optional for our users. So I would add the dependency to the "cli" group in setup.py.

Side question: is this something that would integrate well with Windows cmd ?

Freed-Wu commented 1 year ago

should be optional for our users

is this something that would integrate well with Windows cmd

Freed-Wu commented 1 year ago

I would add the dependency to the "cli" group in setup.py.

Why not completion to keep same as these examples?

Wauplin commented 1 year ago

Why not completion to keep same as these examples?

Fine with completion ! :)

And thanks for clarification on supported shells.

Freed-Wu commented 1 year ago

Fine with completion ! :)

OK. I've give a PR with 'completion'

And thanks for clarification on supported shells.

You're welcome.

remyleone commented 10 months ago

Using Click might be helpful here: https://click.palletsprojects.com/en/8.1.x/shell-completion/

Wauplin commented 10 months ago

Using Click might be helpful here: https://click.palletsprojects.com/en/8.1.x/shell-completion/

As a matter of fact, yes we are (re-)considering the idea of using click (or Typer). However this would mean adding a (quite big) dependency to the project which we'd like to avoid -since CLI is only an "option" for huggingface_hub, not everyone uses it-. There are also suggestions from @Freed-Wu about how to implement shell completion with the current setup (see https://github.com/huggingface/huggingface_hub/pull/1207#issuecomment-1779536093). We are trying to see which direction we want to take and (hopefully) will get back here once decided. For the context, the CLI has not been our focus until now but this is changing, especially since we release huggingface-cli upload and huggingface-cli download support.