huggingface-hub 1.0.0rc0__tar.gz → 1.0.0rc1__tar.gz

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 (178) hide show
  1. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/PKG-INFO +1 -1
  2. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/setup.py +2 -0
  3. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/__init__.py +4 -4
  4. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/cli/__init__.py +0 -14
  5. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/cli/_cli_utils.py +79 -2
  6. huggingface_hub-1.0.0rc1/src/huggingface_hub/cli/auth.py +167 -0
  7. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/cli/cache.py +97 -121
  8. huggingface_hub-1.0.0rc1/src/huggingface_hub/cli/download.py +164 -0
  9. huggingface_hub-1.0.0rc1/src/huggingface_hub/cli/hf.py +59 -0
  10. huggingface_hub-1.0.0rc1/src/huggingface_hub/cli/jobs.py +772 -0
  11. huggingface_hub-1.0.0rc1/src/huggingface_hub/cli/lfs.py +175 -0
  12. huggingface_hub-1.0.0rc1/src/huggingface_hub/cli/repo.py +191 -0
  13. huggingface_hub-1.0.0rc1/src/huggingface_hub/cli/repo_files.py +94 -0
  14. huggingface_hub-1.0.0rc1/src/huggingface_hub/cli/system.py +33 -0
  15. huggingface_hub-1.0.0rc1/src/huggingface_hub/cli/upload.py +302 -0
  16. huggingface_hub-1.0.0rc1/src/huggingface_hub/cli/upload_large_folder.py +117 -0
  17. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/errors.py +1 -1
  18. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/utils/__init__.py +1 -1
  19. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/utils/_http.py +5 -5
  20. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub.egg-info/PKG-INFO +1 -1
  21. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub.egg-info/requires.txt +5 -0
  22. huggingface_hub-1.0.0rc0/src/huggingface_hub/cli/auth.py +0 -212
  23. huggingface_hub-1.0.0rc0/src/huggingface_hub/cli/download.py +0 -181
  24. huggingface_hub-1.0.0rc0/src/huggingface_hub/cli/hf.py +0 -63
  25. huggingface_hub-1.0.0rc0/src/huggingface_hub/cli/jobs.py +0 -1099
  26. huggingface_hub-1.0.0rc0/src/huggingface_hub/cli/lfs.py +0 -198
  27. huggingface_hub-1.0.0rc0/src/huggingface_hub/cli/repo.py +0 -247
  28. huggingface_hub-1.0.0rc0/src/huggingface_hub/cli/repo_files.py +0 -128
  29. huggingface_hub-1.0.0rc0/src/huggingface_hub/cli/system.py +0 -52
  30. huggingface_hub-1.0.0rc0/src/huggingface_hub/cli/upload.py +0 -316
  31. huggingface_hub-1.0.0rc0/src/huggingface_hub/cli/upload_large_folder.py +0 -132
  32. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/LICENSE +0 -0
  33. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/MANIFEST.in +0 -0
  34. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/README.md +0 -0
  35. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/pyproject.toml +0 -0
  36. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/setup.cfg +0 -0
  37. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/_commit_api.py +0 -0
  38. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/_commit_scheduler.py +0 -0
  39. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/_inference_endpoints.py +0 -0
  40. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/_jobs_api.py +0 -0
  41. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/_local_folder.py +0 -0
  42. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/_login.py +0 -0
  43. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/_oauth.py +0 -0
  44. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/_snapshot_download.py +0 -0
  45. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/_space_api.py +0 -0
  46. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/_tensorboard_logger.py +0 -0
  47. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/_upload_large_folder.py +0 -0
  48. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/_webhooks_payload.py +0 -0
  49. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/_webhooks_server.py +0 -0
  50. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/commands/__init__.py +0 -0
  51. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/commands/_cli_utils.py +0 -0
  52. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/commands/delete_cache.py +0 -0
  53. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/commands/download.py +0 -0
  54. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/commands/env.py +0 -0
  55. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/commands/huggingface_cli.py +0 -0
  56. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/commands/lfs.py +0 -0
  57. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/commands/repo.py +0 -0
  58. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/commands/repo_files.py +0 -0
  59. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/commands/scan_cache.py +0 -0
  60. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/commands/tag.py +0 -0
  61. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/commands/upload.py +0 -0
  62. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/commands/upload_large_folder.py +0 -0
  63. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/commands/user.py +0 -0
  64. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/commands/version.py +0 -0
  65. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/community.py +0 -0
  66. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/constants.py +0 -0
  67. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/dataclasses.py +0 -0
  68. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/fastai_utils.py +0 -0
  69. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/file_download.py +0 -0
  70. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/hf_api.py +0 -0
  71. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/hf_file_system.py +0 -0
  72. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/hub_mixin.py +0 -0
  73. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/__init__.py +0 -0
  74. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_client.py +0 -0
  75. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_common.py +0 -0
  76. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_generated/__init__.py +0 -0
  77. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_generated/_async_client.py +0 -0
  78. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_generated/types/__init__.py +0 -0
  79. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_generated/types/audio_classification.py +0 -0
  80. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_generated/types/audio_to_audio.py +0 -0
  81. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_generated/types/automatic_speech_recognition.py +0 -0
  82. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_generated/types/base.py +0 -0
  83. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_generated/types/chat_completion.py +0 -0
  84. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_generated/types/depth_estimation.py +0 -0
  85. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_generated/types/document_question_answering.py +0 -0
  86. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_generated/types/feature_extraction.py +0 -0
  87. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_generated/types/fill_mask.py +0 -0
  88. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_generated/types/image_classification.py +0 -0
  89. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_generated/types/image_segmentation.py +0 -0
  90. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_generated/types/image_to_image.py +0 -0
  91. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_generated/types/image_to_text.py +0 -0
  92. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_generated/types/image_to_video.py +0 -0
  93. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_generated/types/object_detection.py +0 -0
  94. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_generated/types/question_answering.py +0 -0
  95. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_generated/types/sentence_similarity.py +0 -0
  96. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_generated/types/summarization.py +0 -0
  97. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_generated/types/table_question_answering.py +0 -0
  98. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_generated/types/text2text_generation.py +0 -0
  99. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_generated/types/text_classification.py +0 -0
  100. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_generated/types/text_generation.py +0 -0
  101. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_generated/types/text_to_audio.py +0 -0
  102. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_generated/types/text_to_image.py +0 -0
  103. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_generated/types/text_to_speech.py +0 -0
  104. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_generated/types/text_to_video.py +0 -0
  105. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_generated/types/token_classification.py +0 -0
  106. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_generated/types/translation.py +0 -0
  107. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_generated/types/video_classification.py +0 -0
  108. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_generated/types/visual_question_answering.py +0 -0
  109. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_generated/types/zero_shot_classification.py +0 -0
  110. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_generated/types/zero_shot_image_classification.py +0 -0
  111. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_generated/types/zero_shot_object_detection.py +0 -0
  112. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_mcp/__init__.py +0 -0
  113. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_mcp/_cli_hacks.py +0 -0
  114. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_mcp/agent.py +0 -0
  115. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_mcp/cli.py +0 -0
  116. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_mcp/constants.py +0 -0
  117. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_mcp/mcp_client.py +0 -0
  118. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_mcp/types.py +0 -0
  119. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_mcp/utils.py +0 -0
  120. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_providers/__init__.py +0 -0
  121. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_providers/_common.py +0 -0
  122. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_providers/black_forest_labs.py +0 -0
  123. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_providers/cerebras.py +0 -0
  124. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_providers/cohere.py +0 -0
  125. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_providers/fal_ai.py +0 -0
  126. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_providers/featherless_ai.py +0 -0
  127. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_providers/fireworks_ai.py +0 -0
  128. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_providers/groq.py +0 -0
  129. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_providers/hf_inference.py +0 -0
  130. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_providers/hyperbolic.py +0 -0
  131. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_providers/nebius.py +0 -0
  132. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_providers/novita.py +0 -0
  133. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_providers/nscale.py +0 -0
  134. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_providers/openai.py +0 -0
  135. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_providers/replicate.py +0 -0
  136. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_providers/sambanova.py +0 -0
  137. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/inference/_providers/together.py +0 -0
  138. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/lfs.py +0 -0
  139. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/py.typed +0 -0
  140. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/repocard.py +0 -0
  141. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/repocard_data.py +0 -0
  142. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/serialization/__init__.py +0 -0
  143. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/serialization/_base.py +0 -0
  144. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/serialization/_dduf.py +0 -0
  145. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/serialization/_torch.py +0 -0
  146. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/templates/datasetcard_template.md +0 -0
  147. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/templates/modelcard_template.md +0 -0
  148. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/utils/_auth.py +0 -0
  149. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/utils/_cache_assets.py +0 -0
  150. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/utils/_cache_manager.py +0 -0
  151. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/utils/_chunk_utils.py +0 -0
  152. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/utils/_datetime.py +0 -0
  153. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/utils/_deprecation.py +0 -0
  154. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/utils/_dotenv.py +0 -0
  155. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/utils/_experimental.py +0 -0
  156. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/utils/_fixes.py +0 -0
  157. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/utils/_git_credential.py +0 -0
  158. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/utils/_headers.py +0 -0
  159. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/utils/_lfs.py +0 -0
  160. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/utils/_pagination.py +0 -0
  161. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/utils/_paths.py +0 -0
  162. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/utils/_runtime.py +0 -0
  163. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/utils/_safetensors.py +0 -0
  164. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/utils/_subprocess.py +0 -0
  165. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/utils/_telemetry.py +0 -0
  166. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/utils/_typing.py +0 -0
  167. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/utils/_validators.py +0 -0
  168. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/utils/_xet.py +0 -0
  169. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/utils/_xet_progress_reporting.py +0 -0
  170. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/utils/endpoint_helpers.py +0 -0
  171. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/utils/insecure_hashlib.py +0 -0
  172. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/utils/logging.py +0 -0
  173. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/utils/sha.py +0 -0
  174. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub/utils/tqdm.py +0 -0
  175. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub.egg-info/SOURCES.txt +0 -0
  176. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub.egg-info/dependency_links.txt +0 -0
  177. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub.egg-info/entry_points.txt +0 -0
  178. {huggingface_hub-1.0.0rc0 → huggingface_hub-1.0.0rc1}/src/huggingface_hub.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: huggingface_hub
3
- Version: 1.0.0rc0
3
+ Version: 1.0.0rc1
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.
@@ -21,6 +21,7 @@ install_requires = [
21
21
  "pyyaml>=5.1",
22
22
  "httpx>=0.23.0, <1",
23
23
  "tqdm>=4.42.1",
24
+ "typer-slim",
24
25
  "typing-extensions>=3.7.4.3", # to be able to import TypeAlias
25
26
  ]
26
27
 
@@ -28,6 +29,7 @@ extras = {}
28
29
 
29
30
  extras["cli"] = [
30
31
  "InquirerPy==0.3.4", # Note: installs `prompt-toolkit` in the background
32
+ "shellingham",
31
33
  ]
32
34
 
33
35
  extras["inference"] = [
@@ -46,7 +46,7 @@ import sys
46
46
  from typing import TYPE_CHECKING
47
47
 
48
48
 
49
- __version__ = "1.0.0.rc0"
49
+ __version__ = "1.0.0.rc1"
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
@@ -516,7 +516,7 @@ _SUBMOD_ATTRS = {
516
516
  "HfHubAsyncTransport",
517
517
  "HfHubTransport",
518
518
  "cached_assets_path",
519
- "close_client",
519
+ "close_session",
520
520
  "dump_environment_info",
521
521
  "get_async_session",
522
522
  "get_session",
@@ -815,7 +815,7 @@ __all__ = [
815
815
  "cancel_access_request",
816
816
  "cancel_job",
817
817
  "change_discussion_status",
818
- "close_client",
818
+ "close_session",
819
819
  "comment_discussion",
820
820
  "create_branch",
821
821
  "create_collection",
@@ -1518,7 +1518,7 @@ if TYPE_CHECKING: # pragma: no cover
1518
1518
  HfHubAsyncTransport, # noqa: F401
1519
1519
  HfHubTransport, # noqa: F401
1520
1520
  cached_assets_path, # noqa: F401
1521
- close_client, # noqa: F401
1521
+ close_session, # noqa: F401
1522
1522
  dump_environment_info, # noqa: F401
1523
1523
  get_async_session, # noqa: F401
1524
1524
  get_session, # noqa: F401
@@ -11,17 +11,3 @@
11
11
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
-
15
- from abc import ABC, abstractmethod
16
- from argparse import _SubParsersAction
17
-
18
-
19
- class BaseHuggingfaceCLICommand(ABC):
20
- @staticmethod
21
- @abstractmethod
22
- def register_subcommand(parser: _SubParsersAction):
23
- raise NotImplementedError()
24
-
25
- @abstractmethod
26
- def run(self):
27
- raise NotImplementedError()
@@ -11,10 +11,17 @@
11
11
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
- """Contains a utility for good-looking prints."""
14
+ """Contains CLI utilities (styling, helpers)."""
15
15
 
16
16
  import os
17
- from typing import Union
17
+ from enum import Enum
18
+ from typing import Annotated, Optional, Union
19
+
20
+ import click
21
+ import typer
22
+
23
+ from huggingface_hub import __version__
24
+ from huggingface_hub.hf_api import HfApi
18
25
 
19
26
 
20
27
  class ANSI:
@@ -67,3 +74,73 @@ def tabulate(rows: list[list[Union[str, int]]], headers: list[str]) -> str:
67
74
  for row in rows:
68
75
  lines.append(row_format.format(*row))
69
76
  return "\n".join(lines)
77
+
78
+
79
+ #### TYPER UTILS
80
+
81
+
82
+ class AlphabeticalMixedGroup(typer.core.TyperGroup):
83
+ """
84
+ Typer Group that lists commands and sub-apps mixed and alphabetically.
85
+ """
86
+
87
+ def list_commands(self, ctx: click.Context) -> list[str]: # type: ignore[name-defined]
88
+ # click.Group stores both commands and sub-groups in `self.commands`
89
+ return sorted(self.commands.keys())
90
+
91
+
92
+ def typer_factory(help: str) -> typer.Typer:
93
+ return typer.Typer(
94
+ help=help,
95
+ add_completion=True,
96
+ rich_markup_mode=None,
97
+ no_args_is_help=True,
98
+ cls=AlphabeticalMixedGroup,
99
+ )
100
+
101
+
102
+ class RepoType(str, Enum):
103
+ model = "model"
104
+ dataset = "dataset"
105
+ space = "space"
106
+
107
+
108
+ RepoIdArg = Annotated[
109
+ str,
110
+ typer.Argument(
111
+ help="The ID of the repo (e.g. `username/repo-name`).",
112
+ ),
113
+ ]
114
+
115
+
116
+ RepoTypeOpt = Annotated[
117
+ RepoType,
118
+ typer.Option(
119
+ help="The type of repository (model, dataset, or space).",
120
+ ),
121
+ ]
122
+
123
+ TokenOpt = Annotated[
124
+ Optional[str],
125
+ typer.Option(
126
+ help="A User Access Token generated from https://huggingface.co/settings/tokens.",
127
+ ),
128
+ ]
129
+
130
+ PrivateOpt = Annotated[
131
+ bool,
132
+ typer.Option(
133
+ help="Whether to create a private repo if repo doesn't exist on the Hub. Ignored if the repo already exists.",
134
+ ),
135
+ ]
136
+
137
+ RevisionOpt = Annotated[
138
+ Optional[str],
139
+ typer.Option(
140
+ help="Git revision id which can be a branch name, a tag, or a commit hash.",
141
+ ),
142
+ ]
143
+
144
+
145
+ def get_hf_api(token: Optional[str] = None) -> HfApi:
146
+ return HfApi(token=token, library_name="hf", library_version=__version__)
@@ -0,0 +1,167 @@
1
+ # Copyright 2020 The HuggingFace Team. All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ """Contains commands to authenticate to the Hugging Face Hub and interact with your repositories.
15
+
16
+ Usage:
17
+ # login and save token locally.
18
+ hf auth login --token=hf_*** --add-to-git-credential
19
+
20
+ # switch between tokens
21
+ hf auth switch
22
+
23
+ # list all tokens
24
+ hf auth list
25
+
26
+ # logout from all tokens
27
+ hf auth logout
28
+
29
+ # check which account you are logged in as
30
+ hf auth whoami
31
+ """
32
+
33
+ from typing import Annotated, Optional
34
+
35
+ import typer
36
+
37
+ from huggingface_hub.constants import ENDPOINT
38
+ from huggingface_hub.errors import HfHubHTTPError
39
+ from huggingface_hub.hf_api import whoami
40
+
41
+ from .._login import auth_list, auth_switch, login, logout
42
+ from ..utils import get_stored_tokens, get_token, logging
43
+ from ._cli_utils import ANSI, TokenOpt, typer_factory
44
+
45
+
46
+ logger = logging.get_logger(__name__)
47
+
48
+ try:
49
+ from InquirerPy import inquirer
50
+ from InquirerPy.base.control import Choice
51
+
52
+ _inquirer_py_available = True
53
+ except ImportError:
54
+ _inquirer_py_available = False
55
+
56
+
57
+ auth_cli = typer_factory(help="Manage authentication (login, logout, etc.).")
58
+
59
+
60
+ @auth_cli.command("login", help="Login using a token from huggingface.co/settings/tokens")
61
+ def auth_login(
62
+ token: TokenOpt = None,
63
+ add_to_git_credential: Annotated[
64
+ bool,
65
+ typer.Option(
66
+ help="Save to git credential helper. Useful only if you plan to run git commands directly.",
67
+ ),
68
+ ] = False,
69
+ ) -> None:
70
+ login(token=token, add_to_git_credential=add_to_git_credential)
71
+
72
+
73
+ @auth_cli.command("logout", help="Logout from a specific token")
74
+ def auth_logout(
75
+ token_name: Annotated[
76
+ Optional[str],
77
+ typer.Option(
78
+ help="Name of token to logout",
79
+ ),
80
+ ] = None,
81
+ ) -> None:
82
+ logout(token_name=token_name)
83
+
84
+
85
+ def _select_token_name() -> Optional[str]:
86
+ token_names = list(get_stored_tokens().keys())
87
+
88
+ if not token_names:
89
+ logger.error("No stored tokens found. Please login first.")
90
+ return None
91
+
92
+ if _inquirer_py_available:
93
+ choices = [Choice(token_name, name=token_name) for token_name in token_names]
94
+ try:
95
+ return inquirer.select(
96
+ message="Select a token to switch to:",
97
+ choices=choices,
98
+ default=None,
99
+ ).execute()
100
+ except KeyboardInterrupt:
101
+ logger.info("Token selection cancelled.")
102
+ return None
103
+ # if inquirer is not available, use a simpler terminal UI
104
+ print("Available stored tokens:")
105
+ for i, token_name in enumerate(token_names, 1):
106
+ print(f"{i}. {token_name}")
107
+ while True:
108
+ try:
109
+ choice = input("Enter the number of the token to switch to (or 'q' to quit): ")
110
+ if choice.lower() == "q":
111
+ return None
112
+ index = int(choice) - 1
113
+ if 0 <= index < len(token_names):
114
+ return token_names[index]
115
+ else:
116
+ print("Invalid selection. Please try again.")
117
+ except ValueError:
118
+ print("Invalid input. Please enter a number or 'q' to quit.")
119
+
120
+
121
+ @auth_cli.command("switch", help="Switch between access tokens")
122
+ def auth_switch_cmd(
123
+ token_name: Annotated[
124
+ Optional[str],
125
+ typer.Option(
126
+ help="Name of the token to switch to",
127
+ ),
128
+ ] = None,
129
+ add_to_git_credential: Annotated[
130
+ bool,
131
+ typer.Option(
132
+ help="Save to git credential helper. Useful only if you plan to run git commands directly.",
133
+ ),
134
+ ] = False,
135
+ ) -> None:
136
+ if token_name is None:
137
+ token_name = _select_token_name()
138
+ if token_name is None:
139
+ print("No token name provided. Aborting.")
140
+ raise typer.Exit()
141
+ auth_switch(token_name, add_to_git_credential=add_to_git_credential)
142
+
143
+
144
+ @auth_cli.command("list", help="List all stored access tokens")
145
+ def auth_list_cmd() -> None:
146
+ auth_list()
147
+
148
+
149
+ @auth_cli.command("whoami", help="Find out which huggingface.co account you are logged in as.")
150
+ def auth_whoami() -> None:
151
+ token = get_token()
152
+ if token is None:
153
+ print("Not logged in")
154
+ raise typer.Exit()
155
+ try:
156
+ info = whoami(token)
157
+ print(ANSI.bold("user: "), info["name"])
158
+ orgs = [org["name"] for org in info["orgs"]]
159
+ if orgs:
160
+ print(ANSI.bold("orgs: "), ",".join(orgs))
161
+
162
+ if ENDPOINT != "https://huggingface.co":
163
+ print(f"Authenticated through private endpoint: {ENDPOINT}")
164
+ except HfHubHTTPError as e:
165
+ print(e)
166
+ print(ANSI.red(e.response.text))
167
+ raise typer.Exit(code=1)
@@ -16,14 +16,15 @@
16
16
 
17
17
  import os
18
18
  import time
19
- from argparse import Namespace, _SubParsersAction
19
+ from enum import Enum
20
20
  from functools import wraps
21
21
  from tempfile import mkstemp
22
- from typing import Any, Callable, Iterable, Literal, Optional, Union
22
+ from typing import Annotated, Any, Callable, Iterable, Optional, Union
23
+
24
+ import typer
23
25
 
24
26
  from ..utils import CachedRepoInfo, CachedRevisionInfo, CacheNotFound, HFCacheInfo, scan_cache_dir
25
- from . import BaseHuggingfaceCLICommand
26
- from ._cli_utils import ANSI, tabulate
27
+ from ._cli_utils import ANSI, tabulate, typer_factory
27
28
 
28
29
 
29
30
  # --- DELETE helpers (from delete_cache.py) ---
@@ -36,10 +37,16 @@ try:
36
37
  except ImportError:
37
38
  _inquirer_py_available = False
38
39
 
39
- SortingOption_T = Literal["alphabetical", "lastUpdated", "lastUsed", "size"]
40
40
  _CANCEL_DELETION_STR = "CANCEL_DELETION"
41
41
 
42
42
 
43
+ class SortingOption(str, Enum):
44
+ alphabetical = "alphabetical"
45
+ lastUpdated = "lastUpdated"
46
+ lastUsed = "lastUsed"
47
+ size = "size"
48
+
49
+
43
50
  def require_inquirer_py(fn: Callable) -> Callable:
44
51
  @wraps(fn)
45
52
  def _inner(*args, **kwargs):
@@ -54,122 +61,93 @@ def require_inquirer_py(fn: Callable) -> Callable:
54
61
  return _inner
55
62
 
56
63
 
57
- class CacheCommand(BaseHuggingfaceCLICommand):
58
- @staticmethod
59
- def register_subcommand(parser: _SubParsersAction):
60
- cache_parser = parser.add_parser("cache", help="Manage local cache directory.")
61
- cache_subparsers = cache_parser.add_subparsers(dest="cache_command", help="Cache subcommands")
64
+ cache_cli = typer_factory(help="Manage local cache directory.")
62
65
 
63
- # Show help if no subcommand is provided
64
- cache_parser.set_defaults(func=lambda args: cache_parser.print_help())
65
66
 
66
- # Scan subcommand
67
- scan_parser = cache_subparsers.add_parser("scan", help="Scan cache directory.")
68
- scan_parser.add_argument(
69
- "--dir",
70
- type=str,
71
- default=None,
72
- help="cache directory to scan (optional). Default to the default HuggingFace cache.",
73
- )
74
- scan_parser.add_argument(
67
+ @cache_cli.command("scan", help="Scan the cache directory")
68
+ def cache_scan(
69
+ dir: Annotated[
70
+ Optional[str],
71
+ typer.Option(
72
+ help="Cache directory to scan (defaults to Hugging Face cache).",
73
+ ),
74
+ ] = None,
75
+ verbose: Annotated[
76
+ int,
77
+ typer.Option(
75
78
  "-v",
76
79
  "--verbose",
77
- action="count",
78
- default=0,
79
- help="show a more verbose output",
80
- )
81
- scan_parser.set_defaults(func=CacheCommand, cache_command="scan")
82
- # Delete subcommand
83
- delete_parser = cache_subparsers.add_parser("delete", help="Delete revisions from the cache directory.")
84
- delete_parser.add_argument(
85
- "--dir",
86
- type=str,
87
- default=None,
88
- help="cache directory (optional). Default to the default HuggingFace cache.",
89
- )
90
- delete_parser.add_argument(
91
- "--disable-tui",
92
- action="store_true",
93
- help=(
94
- "Disable Terminal User Interface (TUI) mode. Useful if your platform/terminal doesn't support the multiselect menu."
95
- ),
96
- )
97
- delete_parser.add_argument(
98
- "--sort",
99
- nargs="?",
100
- choices=["alphabetical", "lastUpdated", "lastUsed", "size"],
101
- help=(
102
- "Sort repositories by the specified criteria. Options: "
103
- "'alphabetical' (A-Z), "
104
- "'lastUpdated' (newest first), "
105
- "'lastUsed' (most recent first), "
106
- "'size' (largest first)."
107
- ),
108
- )
109
- delete_parser.set_defaults(func=CacheCommand, cache_command="delete")
110
-
111
- def __init__(self, args: Namespace) -> None:
112
- self.args = args
113
- self.verbosity: int = getattr(args, "verbose", 0)
114
- self.cache_dir: Optional[str] = getattr(args, "dir", None)
115
- self.disable_tui: bool = getattr(args, "disable_tui", False)
116
- self.sort_by: Optional[SortingOption_T] = getattr(args, "sort", None)
117
- self.cache_command: Optional[str] = getattr(args, "cache_command", None)
118
-
119
- def run(self):
120
- if self.cache_command == "scan":
121
- self._run_scan()
122
- elif self.cache_command == "delete":
123
- self._run_delete()
80
+ count=True,
81
+ help="Increase verbosity (-v, -vv, -vvv).",
82
+ ),
83
+ ] = 0,
84
+ ) -> None:
85
+ try:
86
+ t0 = time.time()
87
+ hf_cache_info = scan_cache_dir(dir)
88
+ t1 = time.time()
89
+ except CacheNotFound as exc:
90
+ print(f"Cache directory not found: {str(exc.cache_dir)}")
91
+ return
92
+ print(get_table(hf_cache_info, verbosity=verbose))
93
+ print(
94
+ f"\nDone in {round(t1 - t0, 1)}s. Scanned {len(hf_cache_info.repos)} repo(s)"
95
+ f" for a total of {ANSI.red(hf_cache_info.size_on_disk_str)}."
96
+ )
97
+ if len(hf_cache_info.warnings) > 0:
98
+ message = f"Got {len(hf_cache_info.warnings)} warning(s) while scanning."
99
+ if verbose >= 3:
100
+ print(ANSI.gray(message))
101
+ for warning in hf_cache_info.warnings:
102
+ print(ANSI.gray(str(warning)))
124
103
  else:
125
- print("Please specify a cache subcommand (scan or delete). Use -h for help.")
126
-
127
- def _run_scan(self):
128
- try:
129
- t0 = time.time()
130
- hf_cache_info = scan_cache_dir(self.cache_dir)
131
- t1 = time.time()
132
- except CacheNotFound as exc:
133
- cache_dir = exc.cache_dir
134
- print(f"Cache directory not found: {cache_dir}")
135
- return
136
- print(get_table(hf_cache_info, verbosity=self.verbosity))
137
- print(
138
- f"\nDone in {round(t1 - t0, 1)}s. Scanned {len(hf_cache_info.repos)} repo(s)"
139
- f" for a total of {ANSI.red(hf_cache_info.size_on_disk_str)}."
140
- )
141
- if len(hf_cache_info.warnings) > 0:
142
- message = f"Got {len(hf_cache_info.warnings)} warning(s) while scanning."
143
- if self.verbosity >= 3:
144
- print(ANSI.gray(message))
145
- for warning in hf_cache_info.warnings:
146
- print(ANSI.gray(str(warning)))
147
- else:
148
- print(ANSI.gray(message + " Use -vvv to print details."))
149
-
150
- def _run_delete(self):
151
- hf_cache_info = scan_cache_dir(self.cache_dir)
152
- if self.disable_tui:
153
- selected_hashes = _manual_review_no_tui(hf_cache_info, preselected=[], sort_by=self.sort_by)
104
+ print(ANSI.gray(message + " Use -vvv to print details."))
105
+
106
+
107
+ @cache_cli.command("delete", help="Delete revisions from the cache directory")
108
+ def cache_delete(
109
+ dir: Annotated[
110
+ Optional[str],
111
+ typer.Option(
112
+ help="Cache directory (defaults to Hugging Face cache).",
113
+ ),
114
+ ] = None,
115
+ disable_tui: Annotated[
116
+ bool,
117
+ typer.Option(
118
+ help="Disable Terminal User Interface (TUI) mode. Useful if your platform/terminal doesn't support the multiselect menu.",
119
+ ),
120
+ ] = False,
121
+ sort: Annotated[
122
+ Optional[SortingOption],
123
+ typer.Option(
124
+ help="Sort repositories by the specified criteria. Options: 'alphabetical' (A-Z), 'lastUpdated' (newest first), 'lastUsed' (most recent first), 'size' (largest first).",
125
+ ),
126
+ ] = None,
127
+ ) -> None:
128
+ hf_cache_info = scan_cache_dir(dir)
129
+ sort_by = sort.value if sort is not None else None
130
+ if disable_tui:
131
+ selected_hashes = _manual_review_no_tui(hf_cache_info, preselected=[], sort_by=sort_by)
132
+ else:
133
+ selected_hashes = _manual_review_tui(hf_cache_info, preselected=[], sort_by=sort_by)
134
+ if len(selected_hashes) > 0 and _CANCEL_DELETION_STR not in selected_hashes:
135
+ confirm_message = _get_expectations_str(hf_cache_info, selected_hashes) + " Confirm deletion ?"
136
+ if disable_tui:
137
+ confirmed = _ask_for_confirmation_no_tui(confirm_message)
154
138
  else:
155
- selected_hashes = _manual_review_tui(hf_cache_info, preselected=[], sort_by=self.sort_by)
156
- if len(selected_hashes) > 0 and _CANCEL_DELETION_STR not in selected_hashes:
157
- confirm_message = _get_expectations_str(hf_cache_info, selected_hashes) + " Confirm deletion ?"
158
- if self.disable_tui:
159
- confirmed = _ask_for_confirmation_no_tui(confirm_message)
160
- else:
161
- confirmed = _ask_for_confirmation_tui(confirm_message)
162
- if confirmed:
163
- strategy = hf_cache_info.delete_revisions(*selected_hashes)
164
- print("Start deletion.")
165
- strategy.execute()
166
- print(
167
- f"Done. Deleted {len(strategy.repos)} repo(s) and"
168
- f" {len(strategy.snapshots)} revision(s) for a total of"
169
- f" {strategy.expected_freed_size_str}."
170
- )
171
- return
172
- print("Deletion is cancelled. Do nothing.")
139
+ confirmed = _ask_for_confirmation_tui(confirm_message)
140
+ if confirmed:
141
+ strategy = hf_cache_info.delete_revisions(*selected_hashes)
142
+ print("Start deletion.")
143
+ strategy.execute()
144
+ print(
145
+ f"Done. Deleted {len(strategy.repos)} repo(s) and"
146
+ f" {len(strategy.snapshots)} revision(s) for a total of"
147
+ f" {strategy.expected_freed_size_str}."
148
+ )
149
+ return
150
+ print("Deletion is cancelled. Do nothing.")
173
151
 
174
152
 
175
153
  def get_table(hf_cache_info: HFCacheInfo, *, verbosity: int = 0) -> str:
@@ -228,7 +206,7 @@ def get_table(hf_cache_info: HFCacheInfo, *, verbosity: int = 0) -> str:
228
206
  )
229
207
 
230
208
 
231
- def _get_repo_sorting_key(repo: CachedRepoInfo, sort_by: Optional[SortingOption_T] = None):
209
+ def _get_repo_sorting_key(repo: CachedRepoInfo, sort_by: Optional[str] = None):
232
210
  if sort_by == "alphabetical":
233
211
  return (repo.repo_type, repo.repo_id.lower())
234
212
  elif sort_by == "lastUpdated":
@@ -242,9 +220,7 @@ def _get_repo_sorting_key(repo: CachedRepoInfo, sort_by: Optional[SortingOption_
242
220
 
243
221
 
244
222
  @require_inquirer_py
245
- def _manual_review_tui(
246
- hf_cache_info: HFCacheInfo, preselected: list[str], sort_by: Optional[SortingOption_T] = None
247
- ) -> list[str]:
223
+ def _manual_review_tui(hf_cache_info: HFCacheInfo, preselected: list[str], sort_by: Optional[str] = None) -> list[str]:
248
224
  choices = _get_tui_choices_from_scan(repos=hf_cache_info.repos, preselected=preselected, sort_by=sort_by)
249
225
  checkbox = inquirer.checkbox(
250
226
  message="Select revisions to delete:",
@@ -277,7 +253,7 @@ def _ask_for_confirmation_tui(message: str, default: bool = True) -> bool:
277
253
 
278
254
 
279
255
  def _get_tui_choices_from_scan(
280
- repos: Iterable[CachedRepoInfo], preselected: list[str], sort_by: Optional[SortingOption_T] = None
256
+ repos: Iterable[CachedRepoInfo], preselected: list[str], sort_by: Optional[str] = None
281
257
  ) -> list:
282
258
  choices: list[Union["Choice", "Separator"]] = []
283
259
  choices.append(
@@ -306,7 +282,7 @@ def _get_tui_choices_from_scan(
306
282
 
307
283
 
308
284
  def _manual_review_no_tui(
309
- hf_cache_info: HFCacheInfo, preselected: list[str], sort_by: Optional[SortingOption_T] = None
285
+ hf_cache_info: HFCacheInfo, preselected: list[str], sort_by: Optional[str] = None
310
286
  ) -> list[str]:
311
287
  fd, tmp_path = mkstemp(suffix=".txt")
312
288
  os.close(fd)