huggingface_hub
b6145e74 - ✨ New `create_commit` API (#888)

Commit
3 years ago
✨ New `create_commit` API (#888) * ✨ New `commit_files` API * ✨ commit_folder utility * 🔊 Add debug logs * 💄 Code quality * 🚚 Move `hf_hub_url` to `.utils.endpoint_helpers` To avoid a circular import * ♻ Refactoring - Rename `commit_files` -> `create_commit` - Refactor `upload_file`, `commit_folder` and `delete_file` to use `create_commit` - Add `create_pr` kwarg to create a Pull Request - Add support for File objects and `bytes` in `create_commit` - Move `hf_hub_url` to `utils.endpoint_helpers` to avoid a circular import * 🧪 Add tests * 🚚 `commit_folder` -> `upload_folder` * Re-export CommitOperations * Re-exports * ⏪ Revert changes to testing_constants * 💚 Post-rebase fixes * ♻ Refactoring and docstrings * Refacto * 💚 Fix imports for 3.7 * 🔥 Remove dubious type hints * Cleaner use of SliceFileObj * 🚚 Regroup LFS utils together * ✅ Add tests for sha_fileobj * 🎨 More consistent naming * ✅ Test UploadInfo * ✅ Add unit tests for SliceFileObj ctx manager * 💄 Code quality 🙈 * 🩹 Fix import in commands 🤡 * 🏗 Change staging URL * ✅ Fix tests ? * ✅ Use `hf_hub_download` API in tests * 📝 Add docstring for `create_commit` API * 🚧 Multi-threaded upload in `create_commit` * ♻ Refactoring of multi-threaded upload Thanks @Wauplin !! * 👌 Changes from code review - 📝 Add and update documentation - ♻ Remove TypedDict usage and introduce ad-hoc validation - 🧪 Re-add a removed test - 🎨 Simplify `CommitOperationAdd.b64content` * ✅ Various small fixes Fix typo Fix URL prefix * Add support for verify action * ✅ Fix url prefix logic in post_lfs_batch_info * ✨ Make SliceFileObj seekable * 👌 Changes from code review - 💄 HF Hub -> Hub - 💄 Documentation conventions: single backticks - 💄 Documentation consistency / improvements - 🎨 `commit_summary` -> `commit_message` Co-authored-by: Omar Sansevioro <osanseviero@users.noreply.github.com> * 💄 Testing conventions * 📝 Some more documentation * ✨ Update update_metadata method * ↩ Backwards-compatibility & deprecation * 🔒 Pass `token` to Hub requests * ✅ Test binary file upload * ✅ Fix verify call * ✅ Also test uploads in private repos * ✨ Support revisions with slashes in hf_hub_url * ✅ Add a test for creating a PR with `create_commit` * Change deprecation version to 0.10.0 * 🎨 Code quality * Fixup merge * Revert "Fixup merge" This reverts commit 3e82aad47ab93ff899c622abf67510cfe299eb70. * ✅ Fix create_pr test * ✅ Fix upload_folder test * 🩹 Remove Authorization header when downloading a LFS file * 💄 Code quality * 📝 Deprecation period consistency * ⚰ Remove _legacy_upload_file * 🚚 `commit_api` -> `_commit_api` * 🎨 API changes - `CommitOperationAdd.upload_info` -> `CommitOperationAdd._upload_info` (make private) - `CommitOperationAdd.fileobj` -> `CommitOperationAdd.as_file` (clearer) - More thorough documentation for `CommitOperationAdd.validate` * ♻ `upload_file` & `upload_folder` consistency - Backwards-compatibility (don't change the semantic nor the return value) - Consistent behavior between the two methods - Add some tests * ⏪ Revert move of hf_hub_url method * ⏪ re-add FileSlice and deprecate it * 🩹 Small fixes & dedup * ✅ Fix revision and raise RuntimeEror * 🔗 Correct syntax for hyperlinks * ✅ Oopsie * 🔥 Remove FileSlice once again * 💄 Code quality * 📝 Add some documentation about `create_commit` * ♻ Make validation func private * 🩹 Fix typo Co-authored-by: Eliott Coyac <coyotte508@users.noreply.github.com> Co-authored-by: Eliott Coyac <coyotte508@users.noreply.github.com>
Author
Parents
Loading