pypi huggingface-hub 1.14.0
[v1.14.0] Handle Spaces secrets & variables from CLI and other improvements

5 hours ago

๐Ÿ–ฅ๏ธ Manage Space secrets and variables from the CLI

You can now manage Space secrets and environment variables directly from the command line with two new hf spaces subgroups: secrets and variables. Use hf spaces secrets to add, list, and delete write-only secrets, and hf spaces variables to add, list, and delete readable environment variables. Both add commands support multiple -s/-e flags and --secrets-file/-env-file for loading from dotenv files. On the Python side, HfApi.get_space_secrets() returns secret metadata (key, description, updated timestamp) without ever revealing values.

# List secrets (values are write-only โ€” only keys and timestamps are shown)
$ hf spaces secrets ls username/my-space

# Add secrets
$ hf spaces secrets add username/my-space -s OPENAI_API_KEY=sk-...
$ hf spaces secrets add username/my-space --secrets-file .env.secrets

# Delete a secret (confirmation prompt, use --yes to skip)
$ hf spaces secrets delete username/my-space OPENAI_API_KEY --yes

# List, add, and delete variables (values are readable)
$ hf spaces variables ls username/my-space
$ hf spaces variables add username/my-space -e MODEL_ID=gpt2 -e MAX_TOKENS=512
$ hf spaces variables delete username/my-space MAX_TOKENS --yes
  • [CLI] Add hf spaces secrets and variables subgroups by @davanstrien in #4170
  • [CLI] Add get_space_secrets + hf spaces secrets ls by @Wauplin in #4182

๐Ÿ“š Documentation: CLI guide ยท Manage your Space

๐Ÿชฃ Rsync-style trailing slash for bucket folder copies

hf buckets cp now supports rsync-style trailing slash semantics when copying folders. A trailing / on the source path copies only the folder's contents to the destination, while omitting it nests the folder itself โ€” matching the behavior you'd expect from rsync. This makes it possible to flatten directory structures during copies, which was not possible before. Additionally, copy_files now raises an explicit EntryNotFoundError when the source path resolves to no files, instead of silently succeeding with zero operations.

# Without trailing slash: "logs" dir is nested => dst/logs/...
$ hf buckets cp hf://buckets/username/src-bucket/logs hf://buckets/username/dst/

# With trailing slash: only contents of "logs" are copied => dst/...
$ hf buckets cp hf://buckets/username/src-bucket/logs/ hf://buckets/username/dst/
  • [Buckets] Support rsync-style trailing slash in copy_files by @Wauplin in #4187
  • [CLI] Raise error when copy_files source doesn't exist by @Wauplin in #4186

๐Ÿ“š Documentation: Buckets guide ยท CLI guide

๐Ÿ’” Breaking Change

  • [CLI] Rename hf skills upgrade -> hf skills update by @hanouticelina in #4176 โ€” hf skills upgrade no longer exists; use hf skills update instead.
  • [CLI] Add out.status() by @hanouticelina in #4171 โ€” status updates (spinners/progress) on hf extensions install and hf spaces dev-mode are now suppressed when using --format json, --quiet, or --format agent.

๐Ÿ–ฅ๏ธ CLI

๐Ÿ› Bug and typo fixes

๐Ÿ—๏ธ Internal

  • Post-release: bump version to 1.14.0.dev0 by @huggingface-hub-bot[bot] in #4172
  • [Release] Move social drafts to minor-release and archive release notes to bucket by @Wauplin in #4173
  • Update unit test warnings check to ignore unrelated deprecation warnings by @seanses in #4188
  • [internal] Untrack useless files by @Wauplin in #4191

Don't miss a new huggingface-hub release

NewReleases is sending notifications on new releases.