huggingface-hub 0.33.5__py3-none-any.whl → 0.34.0rc0__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.

Files changed (68) hide show
  1. huggingface_hub/__init__.py +487 -525
  2. huggingface_hub/_commit_api.py +21 -28
  3. huggingface_hub/_jobs_api.py +145 -0
  4. huggingface_hub/_local_folder.py +7 -1
  5. huggingface_hub/_login.py +5 -5
  6. huggingface_hub/_oauth.py +1 -1
  7. huggingface_hub/_snapshot_download.py +11 -6
  8. huggingface_hub/_upload_large_folder.py +46 -23
  9. huggingface_hub/cli/__init__.py +27 -0
  10. huggingface_hub/cli/_cli_utils.py +69 -0
  11. huggingface_hub/cli/auth.py +210 -0
  12. huggingface_hub/cli/cache.py +405 -0
  13. huggingface_hub/cli/download.py +181 -0
  14. huggingface_hub/cli/hf.py +66 -0
  15. huggingface_hub/cli/jobs.py +522 -0
  16. huggingface_hub/cli/lfs.py +198 -0
  17. huggingface_hub/cli/repo.py +243 -0
  18. huggingface_hub/cli/repo_files.py +128 -0
  19. huggingface_hub/cli/system.py +52 -0
  20. huggingface_hub/cli/upload.py +316 -0
  21. huggingface_hub/cli/upload_large_folder.py +132 -0
  22. huggingface_hub/commands/_cli_utils.py +5 -0
  23. huggingface_hub/commands/delete_cache.py +3 -1
  24. huggingface_hub/commands/download.py +4 -0
  25. huggingface_hub/commands/env.py +3 -0
  26. huggingface_hub/commands/huggingface_cli.py +2 -0
  27. huggingface_hub/commands/repo.py +4 -0
  28. huggingface_hub/commands/repo_files.py +4 -0
  29. huggingface_hub/commands/scan_cache.py +3 -1
  30. huggingface_hub/commands/tag.py +3 -1
  31. huggingface_hub/commands/upload.py +4 -0
  32. huggingface_hub/commands/upload_large_folder.py +3 -1
  33. huggingface_hub/commands/user.py +11 -1
  34. huggingface_hub/commands/version.py +3 -0
  35. huggingface_hub/constants.py +1 -0
  36. huggingface_hub/file_download.py +16 -5
  37. huggingface_hub/hf_api.py +519 -7
  38. huggingface_hub/hf_file_system.py +8 -16
  39. huggingface_hub/hub_mixin.py +3 -3
  40. huggingface_hub/inference/_client.py +38 -39
  41. huggingface_hub/inference/_common.py +38 -11
  42. huggingface_hub/inference/_generated/_async_client.py +50 -51
  43. huggingface_hub/inference/_generated/types/__init__.py +1 -0
  44. huggingface_hub/inference/_generated/types/image_to_video.py +60 -0
  45. huggingface_hub/inference/_mcp/cli.py +36 -18
  46. huggingface_hub/inference/_mcp/constants.py +8 -0
  47. huggingface_hub/inference/_mcp/types.py +3 -0
  48. huggingface_hub/inference/_providers/__init__.py +4 -1
  49. huggingface_hub/inference/_providers/_common.py +3 -6
  50. huggingface_hub/inference/_providers/fal_ai.py +85 -42
  51. huggingface_hub/inference/_providers/hf_inference.py +17 -9
  52. huggingface_hub/inference/_providers/replicate.py +19 -1
  53. huggingface_hub/keras_mixin.py +2 -2
  54. huggingface_hub/repocard.py +1 -1
  55. huggingface_hub/repository.py +2 -2
  56. huggingface_hub/utils/_auth.py +1 -1
  57. huggingface_hub/utils/_cache_manager.py +2 -2
  58. huggingface_hub/utils/_dotenv.py +51 -0
  59. huggingface_hub/utils/_headers.py +1 -1
  60. huggingface_hub/utils/_runtime.py +1 -1
  61. huggingface_hub/utils/_xet.py +6 -2
  62. huggingface_hub/utils/_xet_progress_reporting.py +141 -0
  63. {huggingface_hub-0.33.5.dist-info → huggingface_hub-0.34.0rc0.dist-info}/METADATA +7 -8
  64. {huggingface_hub-0.33.5.dist-info → huggingface_hub-0.34.0rc0.dist-info}/RECORD +68 -51
  65. {huggingface_hub-0.33.5.dist-info → huggingface_hub-0.34.0rc0.dist-info}/entry_points.txt +1 -0
  66. {huggingface_hub-0.33.5.dist-info → huggingface_hub-0.34.0rc0.dist-info}/LICENSE +0 -0
  67. {huggingface_hub-0.33.5.dist-info → huggingface_hub-0.34.0rc0.dist-info}/WHEEL +0 -0
  68. {huggingface_hub-0.33.5.dist-info → huggingface_hub-0.34.0rc0.dist-info}/top_level.txt +0 -0
@@ -41,7 +41,7 @@ from huggingface_hub.hf_api import HfApi
41
41
 
42
42
  from .._login import auth_list, auth_switch, login, logout
43
43
  from ..utils import get_stored_tokens, get_token, logging
44
- from ._cli_utils import ANSI
44
+ from ._cli_utils import ANSI, show_deprecation_warning
45
45
 
46
46
 
47
47
  logger = logging.get_logger(__name__)
@@ -107,6 +107,8 @@ class BaseUserCommand:
107
107
 
108
108
  class LoginCommand(BaseUserCommand):
109
109
  def run(self):
110
+ show_deprecation_warning("huggingface-cli login", "hf auth login")
111
+
110
112
  logging.set_verbosity_info()
111
113
  login(
112
114
  token=self.args.token,
@@ -116,12 +118,16 @@ class LoginCommand(BaseUserCommand):
116
118
 
117
119
  class LogoutCommand(BaseUserCommand):
118
120
  def run(self):
121
+ show_deprecation_warning("huggingface-cli logout", "hf auth logout")
122
+
119
123
  logging.set_verbosity_info()
120
124
  logout(token_name=self.args.token_name)
121
125
 
122
126
 
123
127
  class AuthSwitchCommand(BaseUserCommand):
124
128
  def run(self):
129
+ show_deprecation_warning("huggingface-cli auth switch", "hf auth switch")
130
+
125
131
  logging.set_verbosity_info()
126
132
  token_name = self.args.token_name
127
133
  if token_name is None:
@@ -173,12 +179,16 @@ class AuthSwitchCommand(BaseUserCommand):
173
179
 
174
180
  class AuthListCommand(BaseUserCommand):
175
181
  def run(self):
182
+ show_deprecation_warning("huggingface-cli auth list", "hf auth list")
183
+
176
184
  logging.set_verbosity_info()
177
185
  auth_list()
178
186
 
179
187
 
180
188
  class WhoamiCommand(BaseUserCommand):
181
189
  def run(self):
190
+ show_deprecation_warning("huggingface-cli whoami", "hf auth whoami")
191
+
182
192
  token = get_token()
183
193
  if token is None:
184
194
  print("Not logged in")
@@ -22,6 +22,7 @@ from argparse import _SubParsersAction
22
22
  from huggingface_hub import __version__
23
23
 
24
24
  from . import BaseHuggingfaceCLICommand
25
+ from ._cli_utils import show_deprecation_warning
25
26
 
26
27
 
27
28
  class VersionCommand(BaseHuggingfaceCLICommand):
@@ -34,4 +35,6 @@ class VersionCommand(BaseHuggingfaceCLICommand):
34
35
  version_parser.set_defaults(func=VersionCommand)
35
36
 
36
37
  def run(self) -> None:
38
+ show_deprecation_warning("huggingface-cli version", "hf version")
39
+
37
40
  print(f"huggingface_hub version: {__version__}")
@@ -291,3 +291,4 @@ HUGGINGFACE_HEADER_LINK_XET_AUTH_KEY = "xet-auth"
291
291
 
292
292
  default_xet_cache_path = os.path.join(HF_HOME, "xet")
293
293
  HF_XET_CACHE = os.getenv("HF_XET_CACHE", default_xet_cache_path)
294
+ HF_HUB_DISABLE_XET: bool = _is_true(os.environ.get("HF_HUB_DISABLE_XET"))
@@ -1136,10 +1136,18 @@ def _hf_hub_download_to_cache_dir(
1136
1136
 
1137
1137
  # Some Windows versions do not allow for paths longer than 255 characters.
1138
1138
  # In this case, we must specify it as an extended path by using the "\\?\" prefix.
1139
- if os.name == "nt" and len(os.path.abspath(lock_path)) > 255:
1139
+ if (
1140
+ os.name == "nt"
1141
+ and len(os.path.abspath(lock_path)) > 255
1142
+ and not os.path.abspath(lock_path).startswith("\\\\?\\")
1143
+ ):
1140
1144
  lock_path = "\\\\?\\" + os.path.abspath(lock_path)
1141
1145
 
1142
- if os.name == "nt" and len(os.path.abspath(blob_path)) > 255:
1146
+ if (
1147
+ os.name == "nt"
1148
+ and len(os.path.abspath(blob_path)) > 255
1149
+ and not os.path.abspath(blob_path).startswith("\\\\?\\")
1150
+ ):
1143
1151
  blob_path = "\\\\?\\" + os.path.abspath(blob_path)
1144
1152
 
1145
1153
  Path(lock_path).parent.mkdir(parents=True, exist_ok=True)
@@ -1407,6 +1415,7 @@ def get_hf_file_metadata(
1407
1415
  library_version: Optional[str] = None,
1408
1416
  user_agent: Union[Dict, str, None] = None,
1409
1417
  headers: Optional[Dict[str, str]] = None,
1418
+ endpoint: Optional[str] = None,
1410
1419
  ) -> HfFileMetadata:
1411
1420
  """Fetch metadata of a file versioned on the Hub for a given url.
1412
1421
 
@@ -1432,6 +1441,8 @@ def get_hf_file_metadata(
1432
1441
  The user-agent info in the form of a dictionary or a string.
1433
1442
  headers (`dict`, *optional*):
1434
1443
  Additional headers to be sent with the request.
1444
+ endpoint (`str`, *optional*):
1445
+ Endpoint of the Hub. Defaults to <https://huggingface.co>.
1435
1446
 
1436
1447
  Returns:
1437
1448
  A [`HfFileMetadata`] object containing metadata such as location, etag, size and
@@ -1471,7 +1482,7 @@ def get_hf_file_metadata(
1471
1482
  size=_int_or_none(
1472
1483
  r.headers.get(constants.HUGGINGFACE_HEADER_X_LINKED_SIZE) or r.headers.get("Content-Length")
1473
1484
  ),
1474
- xet_file_data=parse_xet_file_data_from_response(r), # type: ignore
1485
+ xet_file_data=parse_xet_file_data_from_response(r, endpoint=endpoint), # type: ignore
1475
1486
  )
1476
1487
 
1477
1488
 
@@ -1531,7 +1542,7 @@ def _get_metadata_or_catch_error(
1531
1542
  try:
1532
1543
  try:
1533
1544
  metadata = get_hf_file_metadata(
1534
- url=url, proxies=proxies, timeout=etag_timeout, headers=headers, token=token
1545
+ url=url, proxies=proxies, timeout=etag_timeout, headers=headers, token=token, endpoint=endpoint
1535
1546
  )
1536
1547
  except EntryNotFoundError as http_error:
1537
1548
  if storage_folder is not None and relative_filename is not None:
@@ -1715,7 +1726,7 @@ def _download_to_tmp_and_move(
1715
1726
  displayed_filename=filename,
1716
1727
  )
1717
1728
  else:
1718
- if xet_file_data is not None:
1729
+ if xet_file_data is not None and not constants.HF_HUB_DISABLE_XET:
1719
1730
  logger.warning(
1720
1731
  "Xet Storage is enabled for this repo, but the 'hf_xet' package is not installed. "
1721
1732
  "Falling back to regular HTTP download. "