Change8

v1.21.0

Breaking Changes
📦 huggingface-hubView on GitHub →
3 breaking4 features🐛 5 fixes1 deprecations🔧 6 symbols

Summary

This release overhauls the Jobs listing functionality, introducing server-side filtering and lazy pagination for `list_jobs()`, and renames the CLI command from `hf jobs ps` to `hf jobs ls`. A critical bug causing import errors on `login` has also been resolved.

⚠️ Breaking Changes

  • `list_jobs()` now returns an `Iterable[JobInfo]` instead of `list[JobInfo]`. If you indexed the result (`jobs[0]`), you must now wrap the call with `list(...)` to materialize the results immediately (e.g., `list(list_jobs())`).
  • The `-f`/`--filter` option in the `hf jobs ls` CLI command is deprecated. Filtering must now be done using `--status` and `--label` parameters.
  • Glob patterns (`data-*`), negation (`key!=value`), and filtering by `id`/`image`/`command` are no longer supported via the `list_jobs` API or CLI.

Migration Steps

  1. If you relied on indexing the result of `list_jobs()` (e.g., `jobs[0]`), change this to `list(list_jobs())[0]` or iterate over the result.
  2. Replace usage of `-f`/`--filter` in `hf jobs ls` with `--status` and `--label` arguments.

✨ New Features

  • Jobs listing API and CLI now support server-side filtering via `status` and `labels` parameters in `list_jobs()`.
  • `list_jobs()` now returns a lazy iterator (`Iterable[JobInfo]`) for efficient handling of large result sets.
  • The CLI command `hf jobs ps` has been renamed to `hf jobs ls` for consistency, though `ps` and `list` remain as aliases.
  • Added `--limit` option to `hf jobs ls` for pagination control.

🐛 Bug Fixes

  • Fixed a regression causing an `ImportError` when running `from huggingface_hub import login` due to a circular dependency.
  • Requests now retry upon encountering `httpx.RemoteProtocolError`.
  • Fixed `IndexError` in `filter_repo_objects` when provided with an empty allow/ignore pattern.
  • Excluded skipped string tensors from single-shard index during serialization.
  • Fixed `ty`/`mypy` errors related to click 8.4.2 in the CLI.

Affected Symbols

⚡ Deprecations

  • The `-f`/`--filter` option in `hf jobs ls` is deprecated in favor of `--status` and `--label`.