Skip to content

Commit 7f04d92

Browse files
authored
refactor(hf): use the official hf scheme instead of huggingface (#7193)
* refactor(hf): use the official hf scheme instead of huggingface * refactor(hf): rename service directory and feature with backward compatible alias * chore(hf): add backward compatiple aliases for HfBuilder and HfConfig
1 parent 15e2cc0 commit 7f04d92

File tree

21 files changed

+235
-192
lines changed

21 files changed

+235
-192
lines changed

.github/workflows/ci_core.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ jobs:
190190
# FIXME how to support HDFS services in other platforms?
191191
# services-hdfs
192192
services-http
193-
services-huggingface
193+
services-hf
194194
services-ipfs
195195
services-ipmfs
196196
services-memcached

bindings/java/Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ services-all = [
6363
# FIXME how to support HDFS services in bindings?
6464
# "services-hdfs",
6565
# "services-hdfs-native",
66-
"services-huggingface",
66+
"services-hf",
6767
"services-ipfs",
6868
"services-memcached",
6969
"services-mini-moka",
@@ -117,8 +117,9 @@ services-github = ["opendal/services-github"]
117117
services-gridfs = ["opendal/services-gridfs"]
118118
services-hdfs = ["opendal/services-hdfs"]
119119
services-hdfs-native = ["opendal/services-hdfs-native"]
120+
services-hf = ["opendal/services-hf"]
120121
services-http = ["opendal/services-http"]
121-
services-huggingface = ["opendal/services-huggingface"]
122+
services-huggingface = ["services-hf"]
122123
services-ipfs = ["opendal/services-ipfs"]
123124
services-ipmfs = ["opendal/services-ipmfs"]
124125
services-koofr = ["opendal/services-koofr"]

bindings/java/src/utility.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ fn intern_load_enabled_services(env: &mut JNIEnv) -> Result<jobjectArray> {
9292
opendal::services::HDFS_NATIVE_SCHEME,
9393
#[cfg(feature = "services-http")]
9494
opendal::services::HTTP_SCHEME,
95-
#[cfg(feature = "services-huggingface")]
96-
opendal::services::HUGGINGFACE_SCHEME,
95+
#[cfg(feature = "services-hf")]
96+
opendal::services::HF_SCHEME,
9797
#[cfg(feature = "services-ipfs")]
9898
opendal::services::IPFS_SCHEME,
9999
#[cfg(feature = "services-ipmfs")]

bindings/nodejs/Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ services-all = [
6161
# FIXME how to support HDFS services in bindings?
6262
# "services-hdfs",
6363
# "services-hdfs-native",
64-
"services-huggingface",
64+
"services-hf",
6565
"services-ipfs",
6666
"services-memcached",
6767
"services-mini-moka",
@@ -121,7 +121,8 @@ services-gdrive = ["opendal/services-gdrive"]
121121
services-gridfs = ["opendal/services-gridfs"]
122122
services-hdfs = ["opendal/services-hdfs"]
123123
services-hdfs-native = ["opendal/services-hdfs-native"]
124-
services-huggingface = ["opendal/services-huggingface"]
124+
services-hf = ["opendal/services-hf"]
125+
services-huggingface = ["services-hf"]
125126
services-ipfs = ["opendal/services-ipfs"]
126127
services-koofr = ["opendal/services-koofr"]
127128
services-memcached = ["opendal/services-memcached"]

bindings/python/Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ services-all = [
6060
'services-ftp',
6161
'services-gdrive',
6262
'services-gridfs',
63-
'services-huggingface',
63+
'services-hf',
6464
'services-ipfs',
6565
'services-koofr',
6666
'services-memcached',
@@ -122,8 +122,9 @@ services-hdfs = [
122122
"opendal/services-hdfs",
123123
] # FIXME EXCLUDED: how to support HDFS services in bindings?
124124
services-hdfs-native = ["opendal/services-hdfs-native"]
125+
services-hf = ["opendal/services-hf"]
125126
services-http = ["opendal/services-http"]
126-
services-huggingface = ["opendal/services-huggingface"]
127+
services-huggingface = ["services-hf"]
127128
services-ipfs = ["opendal/services-ipfs"]
128129
services-ipmfs = ["opendal/services-ipmfs"]
129130
services-koofr = ["opendal/services-koofr"]

bindings/python/python/opendal/operator.pyi

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,7 +1172,7 @@ class AsyncOperator:
11721172
@typing.overload
11731173
def __new__(
11741174
cls,
1175-
scheme: opendal.services.Scheme.Huggingface | typing.Literal["huggingface"],
1175+
scheme: opendal.services.Scheme.Hf | typing.Literal["hf"],
11761176
/,
11771177
*,
11781178
repo_id: builtins.str = ...,
@@ -1182,7 +1182,7 @@ class AsyncOperator:
11821182
token: builtins.str = ...,
11831183
) -> typing_extensions.Self:
11841184
r"""
1185-
Create a new `AsyncOperator` for `huggingface` service.
1185+
Create a new `AsyncOperator` for `hf` (Hugging Face) service.
11861186
11871187
Parameters
11881188
----------
@@ -1207,7 +1207,7 @@ class AsyncOperator:
12071207
Returns
12081208
-------
12091209
AsyncOperator
1210-
The new `AsyncOperator` for `huggingface` service
1210+
The new `AsyncOperator` for `hf` (Hugging Face) service
12111211
"""
12121212
@typing.overload
12131213
def __new__(
@@ -3412,7 +3412,7 @@ class Operator:
34123412
@typing.overload
34133413
def __new__(
34143414
cls,
3415-
scheme: opendal.services.Scheme.Huggingface | typing.Literal["huggingface"],
3415+
scheme: opendal.services.Scheme.Hf | typing.Literal["hf"],
34163416
/,
34173417
*,
34183418
repo_id: builtins.str = ...,
@@ -3422,7 +3422,7 @@ class Operator:
34223422
token: builtins.str = ...,
34233423
) -> typing_extensions.Self:
34243424
r"""
3425-
Create a new `Operator` for `huggingface` service.
3425+
Create a new `Operator` for `hf` (Hugging Face) service.
34263426
34273427
Parameters
34283428
----------
@@ -3447,7 +3447,7 @@ class Operator:
34473447
Returns
34483448
-------
34493449
Operator
3450-
The new `Operator` for `huggingface` service
3450+
The new `Operator` for `hf` (Hugging Face) service
34513451
"""
34523452
@typing.overload
34533453
def __new__(

bindings/python/python/opendal/services.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class Scheme(enum.Enum):
5252
Gridfs = ...
5353
HdfsNative = ...
5454
Http = ...
55-
Huggingface = ...
55+
Hf = ...
5656
Ipfs = ...
5757
Ipmfs = ...
5858
Koofr = ...

bindings/python/src/services.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ pub enum PyScheme {
9898
HdfsNative,
9999
#[cfg(feature = "services-http")]
100100
Http,
101-
#[cfg(feature = "services-huggingface")]
102-
Huggingface,
101+
#[cfg(feature = "services-hf")]
102+
Hf,
103103
#[cfg(feature = "services-ipfs")]
104104
Ipfs,
105105
#[cfg(feature = "services-ipmfs")]
@@ -1019,7 +1019,7 @@ submit! {
10191019
class Operator:
10201020
@overload
10211021
def __new__(cls,
1022-
scheme: typing.Union[opendal.services.Scheme.Huggingface, typing.Literal["huggingface"]],
1022+
scheme: typing.Union[opendal.services.Scheme.Hf, typing.Literal["hf"]],
10231023
/,
10241024
*,
10251025
endpoint: builtins.str = ...,
@@ -1030,7 +1030,7 @@ submit! {
10301030
token: builtins.str = ...,
10311031
) -> typing_extensions.Self:
10321032
r"""
1033-
Create a new `Operator` for `huggingface` service.
1033+
Create a new `Operator` for `hf` (Hugging Face) service.
10341034
10351035
Parameters
10361036
----------
@@ -1058,7 +1058,7 @@ submit! {
10581058
Returns
10591059
-------
10601060
Operator
1061-
The new `Operator` for `huggingface` service
1061+
The new `Operator` for `hf` (Hugging Face) service
10621062
"""
10631063
"#
10641064
}
@@ -3353,7 +3353,7 @@ submit! {
33533353
class AsyncOperator:
33543354
@overload
33553355
def __new__(cls,
3356-
scheme: typing.Union[opendal.services.Scheme.Huggingface, typing.Literal["huggingface"]],
3356+
scheme: typing.Union[opendal.services.Scheme.Hf, typing.Literal["hf"]],
33573357
/,
33583358
*,
33593359
endpoint: builtins.str = ...,
@@ -3364,7 +3364,7 @@ submit! {
33643364
token: builtins.str = ...,
33653365
) -> typing_extensions.Self:
33663366
r"""
3367-
Create a new `AsyncOperator` for `huggingface` service.
3367+
Create a new `AsyncOperator` for `hf` (Hugging Face) service.
33683368
33693369
Parameters
33703370
----------
@@ -3392,7 +3392,7 @@ submit! {
33923392
Returns
33933393
-------
33943394
AsyncOperator
3395-
The new `AsyncOperator` for `huggingface` service
3395+
The new `AsyncOperator` for `hf` (Hugging Face) service
33963396
"""
33973397
"#
33983398
}
@@ -4884,8 +4884,8 @@ impl_enum_to_str!(
48844884
HdfsNative => "hdfs-native",
48854885
#[cfg(feature = "services-http")]
48864886
Http => "http",
4887-
#[cfg(feature = "services-huggingface")]
4888-
Huggingface => "huggingface",
4887+
#[cfg(feature = "services-hf")]
4888+
Hf => "hf",
48894889
#[cfg(feature = "services-ipfs")]
48904890
Ipfs => "ipfs",
48914891
#[cfg(feature = "services-ipmfs")]

core/Cargo.lock

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,9 @@ services-github = ["dep:opendal-service-github"]
143143
services-gridfs = ["dep:opendal-service-gridfs"]
144144
services-hdfs = ["dep:opendal-service-hdfs"]
145145
services-hdfs-native = ["dep:opendal-service-hdfs-native"]
146+
services-hf = ["dep:opendal-service-hf"]
146147
services-http = ["dep:opendal-service-http"]
147-
services-huggingface = ["dep:opendal-service-huggingface"]
148+
services-huggingface = ["services-hf"]
148149
services-ipfs = ["dep:opendal-service-ipfs"]
149150
services-ipmfs = ["dep:opendal-service-ipmfs"]
150151
services-koofr = ["dep:opendal-service-koofr"]
@@ -257,8 +258,8 @@ opendal-service-github = { path = "services/github", version = "0.55.0", optiona
257258
opendal-service-gridfs = { path = "services/gridfs", version = "0.55.0", optional = true, default-features = false }
258259
opendal-service-hdfs = { path = "services/hdfs", version = "0.55.0", optional = true, default-features = false }
259260
opendal-service-hdfs-native = { path = "services/hdfs-native", version = "0.55.0", optional = true, default-features = false }
261+
opendal-service-hf = { path = "services/hf", version = "0.55.0", optional = true, default-features = false }
260262
opendal-service-http = { path = "services/http", version = "0.55.0", optional = true, default-features = false }
261-
opendal-service-huggingface = { path = "services/huggingface", version = "0.55.0", optional = true, default-features = false }
262263
opendal-service-ipfs = { path = "services/ipfs", version = "0.55.0", optional = true, default-features = false }
263264
opendal-service-ipmfs = { path = "services/ipmfs", version = "0.55.0", optional = true, default-features = false }
264265
opendal-service-koofr = { path = "services/koofr", version = "0.55.0", optional = true, default-features = false }

0 commit comments

Comments
 (0)