Skip to content

Smoothly switch CLI to hf #3224

@Wauplin

Description

@Wauplin

The huggingface_hub library allows users to interact with the Hugging Face Hub. It contains Python methods and a CLI huggingface-cli defined in ./commands.

With the team we're discussion a potential renaming of the CLI to hf with a change in its syntax for clarity and consistency in the naming convention. The current CLI looks like this:

huggingface-cli download
huggingface-cli upload
huggingface-cli repo-files ... delete
huggingface-cli env
huggingface-cli login
huggingface-cli whoami
huggingface-cli logout
huggingface-cli auth switch
huggingface-cli auth list
huggingface-cli repo create
huggingface-cli lfs-enable-largefiles
huggingface-cli scan-cache
huggingface-cli delete-cache
huggingface-cli tag
huggingface-cli version
huggingface-cli upload-large-folder

While the new CLI should look like this

# Similar to https://cli.github.com/manual/gh_auth_status
hf auth login
hf auth logout
hf auth switch
hf auth list
hf auth status
hf auth token (NEW)

# Similar to https://cli.github.com/manual/gh_repo
hf repo create
hf repo delete (NEW)
hf repo tag create
hf repo tag delete (NEW)
hf repo tag list (NEW)
hf repo branch create (NEW)
hf repo branch delete (NEW)
hf repo branch list (NEW)
hf repo settings (NEW) (repo visibility, gated, etc.)
hf repo rename (NEW)

# Files 
hf files download (+ alias hf download ...)
hf files upload (+ alias hf upload ...)
hf files delete
hf files list (NEW)

# Similar to https://cli.github.com/manual/gh_cache
hf cache scan
hf cache delete

# Everything from #prj-jobs-api
hf jobs ...

# Utilities
hf version
hf env

TODOs:

  1. create a new "cli/" folder
  2. create a hf CLI
  3. everything in commands/ must remain untouched for backward compatibility
    1. only exception: for each command => add a yellow warning "hey there is a new CLI. It's now recommended to use "hf ..."" (put the correct command here).
  4. implement commands in the cli/ folder. Please reuse the argparse implementation and make it as modern code as possible. Behavior of the commands should be strictly the same as what's implemented in commands/.
  5. do not implement any of the "NEW" commands. We keep these for later.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions