huggingface_hub
9656fff2 - [API] [CLI] Add `duplicate_repo` (instead of `duplicate_space`) + `hf repos duplicate` (#3880)

Commit
57 days ago
[API] [CLI] Add `duplicate_repo` (instead of `duplicate_space`) + `hf repos duplicate` (#3880) * Add `duplicate_repo` method, deprecate `duplicate_space`, and add CLI - Add `HfApi.duplicate_repo()` method supporting all repo types (model, dataset, space) with server-side duplication (preserves git history and LFS objects). - Include all space-specific options: `space_hardware`, `space_storage`, `space_sleep_time`, `space_secrets`, `space_variables` (matching `create_repo` pattern). - Deprecate `duplicate_space()` until v2.0 — it now delegates to `duplicate_repo(repo_type='space', ...)`. - Add `hf repos duplicate` CLI command with `--type`, `--to-id`, `--private`, and `--exist-ok` options. - Update `__init__.py` exports and auto-generated CLI reference docs. Closes #3825 Co-authored-by: Lucain <Wauplin@users.noreply.github.com> * Fix tests: suppress FutureWarning in deprecated duplicate_space tests - Add @pytest.mark.filterwarnings('ignore::FutureWarning') to all duplicate_space test methods (pytest config uses -Werror::FutureWarning). - Conditionally pass to_id in duplicate_space delegation to avoid @validate_hf_hub_args rejecting None for the to_id parameter. Co-authored-by: Lucain <Wauplin@users.noreply.github.com> * Use expect_deprecation helper instead of filterwarnings Co-authored-by: Lucain <Wauplin@users.noreply.github.com> * Address review: use Warning admonition, make to_id a positional arg - Replace <Deprecated> tag with '> [!WARNING]' admonition in duplicate_space docstring. - Change CLI 'to_id' from --to-id option to optional positional argument. Co-authored-by: Lucain <Wauplin@users.noreply.github.com> * Add CLI tests for duplicate command (implicit and explicit namespace) Co-authored-by: Lucain <Wauplin@users.noreply.github.com> * Update docs: replace duplicate_space with duplicate_repo in guides - repository.md: broaden 'Duplicate a repository' section to cover all repo types (model, dataset, space) with updated examples. - manage-spaces.md: update all duplicate_space calls to duplicate_repo with repo_type='space' and space_* parameter names. Co-authored-by: Lucain <Wauplin@users.noreply.github.com> * None is valid repo id --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Lucain <Wauplin@users.noreply.github.com>
Author
Parents
Loading