feat: change download() and download_dir() to conditionally initialize backend-specific configs#1713
Merged
feat: change download() and download_dir() to conditionally initialize backend-specific configs#1713
download() and download_dir() to conditionally initialize backend-specific configs#1713Conversation
…alize backend-specific configs Refactor backend scheme constants: - Rename `HDFS_SCHEME` to `SCHEME` in hdfs.rs - Rename `HUGGING_FACE_SCHEME` to `SCHEME` in hugging_face.rs - Rename `MODEL_SCOPE_SCHEME` to `SCHEME` in model_scope.rs Add `Scheme::is_supported()` helper method to object_storage.rs to check if a given URL scheme is a supported object storage protocol, along with corresponding unit tests. Refactor `download()` and `download_dir()` in dfget/main.rs to conditionally initialize backend-specific configs (object_storage, hdfs, hugging_face, model_scope) based on the URL scheme instead of always populating all configs unconditionally. Signed-off-by: Gaius <gaius.qi@gmail.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1713 +/- ##
==========================================
- Coverage 50.29% 50.29% -0.01%
==========================================
Files 86 86
Lines 21963 21977 +14
==========================================
+ Hits 11046 11053 +7
- Misses 10917 10924 +7
🚀 New features to boost your workflow:
|
CormickKneey
approved these changes
Mar 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Refactor backend scheme constants:
HDFS_SCHEMEtoSCHEMEin hdfs.rsHUGGING_FACE_SCHEMEtoSCHEMEin hugging_face.rsMODEL_SCOPE_SCHEMEtoSCHEMEin model_scope.rsAdd
Scheme::is_supported()helper method to object_storage.rs to check if a given URL scheme is a supported object storage protocol, along with corresponding unit tests.Refactor
download()anddownload_dir()in dfget/main.rs to conditionally initialize backend-specific configs (object_storage, hdfs, hugging_face, model_scope) based on the URL scheme instead of always populating all configs unconditionally.Related Issue
Motivation and Context
Screenshots (if appropriate)