huggingface-hub 0.34.1__py3-none-any.whl → 0.34.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of huggingface-hub might be problematic. Click here for more details.

@@ -46,7 +46,7 @@ import sys
46
46
  from typing import TYPE_CHECKING
47
47
 
48
48
 
49
- __version__ = "0.34.1"
49
+ __version__ = "0.34.3"
50
50
 
51
51
  # Alphabetical order of definitions is ensured in tests
52
52
  # WARNING: any comment added in this dictionary definition will be lost when
@@ -90,7 +90,7 @@ class LocalDownloadFilePaths:
90
90
  resolved_path = str(path.resolve())
91
91
  # Some Windows versions do not allow for paths longer than 255 characters.
92
92
  # In this case, we must specify it as an extended path by using the "\\?\" prefix.
93
- if len(resolved_path) > 255 and not resolved_path.startswith("\\\\?\\"):
93
+ if os.name == "nt" and len(resolved_path) > 255 and not resolved_path.startswith("\\\\?\\"):
94
94
  path = Path("\\\\?\\" + resolved_path)
95
95
  return path
96
96
 
@@ -195,7 +195,7 @@ class WhoamiCommand(BaseUserCommand):
195
195
  exit()
196
196
  try:
197
197
  info = self._api.whoami(token)
198
- print(info["name"])
198
+ print(ANSI.bold("user: "), info["name"])
199
199
  orgs = [org["name"] for org in info["orgs"]]
200
200
  if orgs:
201
201
  print(ANSI.bold("orgs: "), ",".join(orgs))
@@ -317,9 +317,6 @@ def _get_file_length_from_http_response(response: requests.Response) -> Optional
317
317
 
318
318
  This function extracts the file size from the HTTP response headers, either from the
319
319
  `Content-Range` or `Content-Length` header, if available (in that order).
320
- The HTTP response object containing the headers.
321
- `int` or `None`: The length of the file in bytes if the information is available,
322
- otherwise `None`.
323
320
 
324
321
  Args:
325
322
  response (`requests.Response`):
@@ -329,6 +326,15 @@ def _get_file_length_from_http_response(response: requests.Response) -> Optional
329
326
  `int` or `None`: The length of the file in bytes, or None if not available.
330
327
  """
331
328
 
329
+ # If HTTP response contains compressed body (e.g. gzip), the `Content-Length` header will
330
+ # contain the length of the compressed body, not the uncompressed file size.
331
+ # And at the start of transmission there's no way to know the uncompressed file size for gzip,
332
+ # thus we return None in that case.
333
+ content_encoding = response.headers.get("Content-Encoding", "identity").lower()
334
+ if content_encoding != "identity":
335
+ # gzip/br/deflate/zstd etc
336
+ return None
337
+
332
338
  content_range = response.headers.get("Content-Range")
333
339
  if content_range is not None:
334
340
  return int(content_range.rsplit("/")[-1])
@@ -422,11 +428,7 @@ def http_get(
422
428
  )
423
429
 
424
430
  hf_raise_for_status(r)
425
- content_length = _get_file_length_from_http_response(r)
426
-
427
- # NOTE: 'total' is the total number of bytes to download, not the number of bytes in the file.
428
- # If the file is compressed, the number of bytes in the saved file will be higher than 'total'.
429
- total = resume_size + int(content_length) if content_length is not None else None
431
+ total: Optional[int] = _get_file_length_from_http_response(r)
430
432
 
431
433
  if displayed_filename is None:
432
434
  displayed_filename = url
huggingface_hub/hf_api.py CHANGED
@@ -10287,7 +10287,7 @@ class HfApi:
10287
10287
  python (`str`, *optional*)
10288
10288
  Use a specific Python version. Default is 3.12.
10289
10289
 
10290
- image (`str`, *optional*, defaults to "ghcr.io/astral-sh/uv:python3.12-bookworm-slim"):
10290
+ image (`str`, *optional*, defaults to "ghcr.io/astral-sh/uv:python3.12-bookworm"):
10291
10291
  Use a custom Docker image with `uv` installed.
10292
10292
 
10293
10293
  env (`Dict[str, Any]`, *optional*):
@@ -10320,7 +10320,7 @@ class HfApi:
10320
10320
  >>> run_uv_job(script, dependencies=["trl"], flavor="a10g-small")
10321
10321
  ```
10322
10322
  """
10323
- image = image or "ghcr.io/astral-sh/uv:python3.12-bookworm-slim"
10323
+ image = image or "ghcr.io/astral-sh/uv:python3.12-bookworm"
10324
10324
  env = env or {}
10325
10325
  secrets = secrets or {}
10326
10326
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: huggingface-hub
3
- Version: 0.34.1
3
+ Version: 0.34.3
4
4
  Summary: Client library to download and publish models, datasets and other repos on the huggingface.co hub
5
5
  Home-page: https://github.com/huggingface/huggingface_hub
6
6
  Author: Hugging Face, Inc.
@@ -1,9 +1,9 @@
1
- huggingface_hub/__init__.py,sha256=3BWbuLHQ7NvAfv9C4WFRMK1hgiwDBg-YBbQFRoTaqRw,51837
1
+ huggingface_hub/__init__.py,sha256=XtvzS2pYS1BAQRvkqLeB8zCOG9DCeVQPFrLy9ORuCrs,51837
2
2
  huggingface_hub/_commit_api.py,sha256=68HxFnJE2s-QmGZRHQav5kOMTseYV_ZQi04ADaQmZUk,38979
3
3
  huggingface_hub/_commit_scheduler.py,sha256=tfIoO1xWHjTJ6qy6VS6HIoymDycFPg0d6pBSZprrU2U,14679
4
4
  huggingface_hub/_inference_endpoints.py,sha256=ahmbPcEXsJ_JcMb9TDgdkD8Z2z9uytkFG3_1o6dTm8g,17598
5
5
  huggingface_hub/_jobs_api.py,sha256=XPiQypEwcZQWuEEEAv5MhRak3SV8Y8jyusocjNVAefI,5399
6
- huggingface_hub/_local_folder.py,sha256=2Sf-f9GdNoYW-oFliM5bytRDaAEs6phWknPhuaVa42k,17285
6
+ huggingface_hub/_local_folder.py,sha256=2iHXNgIT3UdSt2PvCovd0NzgVxTRypKb-rvAFLK-gZU,17305
7
7
  huggingface_hub/_login.py,sha256=rcwx9EZdFUB3vuowC5QBiSYS4ImUnBzo04igR1Z8l40,20256
8
8
  huggingface_hub/_oauth.py,sha256=75ya9toHxC0WRKsLOAI212CrssRjTSxs16mHWWNMb3w,18714
9
9
  huggingface_hub/_snapshot_download.py,sha256=b-NzYQcvktsAirIfGQKgzQwu8w0S6lhBTvnJ5S6saw8,16166
@@ -17,8 +17,8 @@ huggingface_hub/constants.py,sha256=nILseAp4rqLu_KQTZDpPGOhepVAPanD7azbomAvovj0,
17
17
  huggingface_hub/dataclasses.py,sha256=sgPdEi2UDprhNPP2PPkiSlzsHdC1WcpwVTLwlHAEcr0,17224
18
18
  huggingface_hub/errors.py,sha256=D7Lw0Jjrf8vfmD0B26LEvg-JWkU8Zq0KDPJOzFY4QLw,11201
19
19
  huggingface_hub/fastai_utils.py,sha256=DpeH9d-6ut2k_nCAAwglM51XmRmgfbRe2SPifpVL5Yk,16745
20
- huggingface_hub/file_download.py,sha256=dt31o0xnWBbguTZuAAuejfJVsR7aUuidVNFvu_LP6wU,78940
21
- huggingface_hub/hf_api.py,sha256=SXuzqHExwpRmrzfbS4Y_ty4FrcYalR5Vuj1K2dxXdMw,464596
20
+ huggingface_hub/file_download.py,sha256=E-NWON01pprbAsw7Kz477JX6f8HTWsdpEdQAtA37t5c,78974
21
+ huggingface_hub/hf_api.py,sha256=wWfC_bu6ieiHxnUITX8GEfrbL5u8TGgSfJRCKRT2y-A,464586
22
22
  huggingface_hub/hf_file_system.py,sha256=nrNOoNHRwf1swebtQvZExSblRjQg9rHKxL7Cslk72uw,46899
23
23
  huggingface_hub/hub_mixin.py,sha256=MArtbUxjXiYeOvOmNBG9I_j5t02m2xCVAcge4waip1w,38091
24
24
  huggingface_hub/inference_api.py,sha256=b4-NhPSn9b44nYKV8tDKXodmE4JVdEymMWL4CVGkzlE,8323
@@ -54,7 +54,7 @@ huggingface_hub/commands/scan_cache.py,sha256=Er5y0paRv0feXnwxe-eAwuJA6xlZ-OdEQ1
54
54
  huggingface_hub/commands/tag.py,sha256=4fgQuXJHG59lTVyOjIUZjxdJDL4JZW4q10XDPSo-gss,6382
55
55
  huggingface_hub/commands/upload.py,sha256=eAJIig4ljtO9FRyGjiz6HbHS-Q4MOQziRgzjQrl5Koo,14576
56
56
  huggingface_hub/commands/upload_large_folder.py,sha256=_1id84BFtbL8HgFRKZ-el_uPrijamz1qWlzO16KbUAc,6254
57
- huggingface_hub/commands/user.py,sha256=dDpi0mLYvTeYf0fhPVQyEJsn7Wrk6gWvR5YHC6RgebU,7516
57
+ huggingface_hub/commands/user.py,sha256=MjG1lwMq1p5QAlBolFnRX_pUxE3Kd3UiPl-nEEQSgXg,7537
58
58
  huggingface_hub/commands/version.py,sha256=rGpCbvxImY9eQqXrshYt609Iws27R75WARmKQrIo6Ok,1390
59
59
  huggingface_hub/inference/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
60
60
  huggingface_hub/inference/_client.py,sha256=5HMQl_xZApB3cUvaplEwaLazVoaRayzb2kQJvvfWGHs,161328
@@ -158,9 +158,9 @@ huggingface_hub/utils/insecure_hashlib.py,sha256=iAaepavFZ5Dhfa5n8KozRfQprKmvcjS
158
158
  huggingface_hub/utils/logging.py,sha256=0A8fF1yh3L9Ka_bCDX2ml4U5Ht0tY8Dr3JcbRvWFuwo,4909
159
159
  huggingface_hub/utils/sha.py,sha256=OFnNGCba0sNcT2gUwaVCJnldxlltrHHe0DS_PCpV3C4,2134
160
160
  huggingface_hub/utils/tqdm.py,sha256=xAKcyfnNHsZ7L09WuEM5Ew5-MDhiahLACbbN2zMmcLs,10671
161
- huggingface_hub-0.34.1.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
162
- huggingface_hub-0.34.1.dist-info/METADATA,sha256=xaTr-pbrzBfbAB1RTLrAXPON2rCp2nJeYcmvA6DGPKM,14699
163
- huggingface_hub-0.34.1.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
164
- huggingface_hub-0.34.1.dist-info/entry_points.txt,sha256=HIzLhjwPTO7U_ncpW4AkmzAuaadr1ajmYagW5mdb5TM,217
165
- huggingface_hub-0.34.1.dist-info/top_level.txt,sha256=8KzlQJAY4miUvjAssOAJodqKOw3harNzuiwGQ9qLSSk,16
166
- huggingface_hub-0.34.1.dist-info/RECORD,,
161
+ huggingface_hub-0.34.3.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
162
+ huggingface_hub-0.34.3.dist-info/METADATA,sha256=zBru0GXxkbWX-hb4D28FRqAyhnKNVFX8dYa1kqOmXA8,14699
163
+ huggingface_hub-0.34.3.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
164
+ huggingface_hub-0.34.3.dist-info/entry_points.txt,sha256=HIzLhjwPTO7U_ncpW4AkmzAuaadr1ajmYagW5mdb5TM,217
165
+ huggingface_hub-0.34.3.dist-info/top_level.txt,sha256=8KzlQJAY4miUvjAssOAJodqKOw3harNzuiwGQ9qLSSk,16
166
+ huggingface_hub-0.34.3.dist-info/RECORD,,