atomgit 1.0.1__tar.gz → 1.0.2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: atomgit
3
- Version: 1.0.1
3
+ Version: 1.0.2
4
4
  Summary: AtomGit模型文件上传下载CLI工具
5
5
  Home-page: https://atomgit.com/gitcode-ai/atomgit_cli
6
6
  Author: AtomGit CLI Team
@@ -8,7 +8,7 @@ AtomGit CLI - 基于Transformers和Hugging Face Hub的模型文件上传下载
8
8
  支持模型和数据集的上传、下载等操作。
9
9
  """
10
10
 
11
- __version__ = '1.0.1'
11
+ __version__ = '1.0.2'
12
12
  __author__ = 'AtomGit CLI Team'
13
13
  __description__ = 'AtomGit模型文件上传下载CLI工具'
14
14
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: atomgit
3
- Version: 1.0.1
3
+ Version: 1.0.2
4
4
  Summary: AtomGit模型文件上传下载CLI工具
5
5
  Home-page: https://atomgit.com/gitcode-ai/atomgit_cli
6
6
  Author: AtomGit CLI Team
@@ -277,6 +277,7 @@ def upload_folder(
277
277
  commit_description: Optional[str] = None,
278
278
  path_in_repo: str = "./",
279
279
  ignore_patterns: Optional[List[str]] = None,
280
+ upload_timeout: float = 300.0,
280
281
  ) -> str:
281
282
  """
282
283
  上传文件夹到AtomGit Hub
@@ -291,6 +292,8 @@ def upload_folder(
291
292
  commit_description (str, 可选): 提交描述
292
293
  path_in_repo (str, 可选): 在仓库中的路径,默认为根目录
293
294
  ignore_patterns (List[str], 可选): 要忽略的文件模式
295
+ upload_timeout (float, 可选): 上传超时时间(秒),默认60秒(1分钟)。
296
+ 对于大文件,服务器处理响应可能需要较长时间。
294
297
 
295
298
  返回:
296
299
  str: 提交的URL或ID
@@ -298,6 +301,7 @@ def upload_folder(
298
301
  示例:
299
302
  >>> upload_folder("./my-model/", "username/repo-name")
300
303
  >>> upload_folder("./data/", "username/repo", path_in_repo="datasets/")
304
+ >>> upload_folder("./big-files/", "username/repo", upload_timeout=1200.0) # 20分钟超时
301
305
  """
302
306
  # 标准化仓库ID
303
307
  normalized_repo_id = _normalize_repo_id(repo_id)
@@ -320,7 +324,7 @@ def upload_folder(
320
324
  # 直接使用原始目录,或者创建临时目录来重新组织结构
321
325
  import tempfile
322
326
  import shutil
323
-
327
+
324
328
  if path_in_repo == "./" or path_in_repo == "." or path_in_repo == "":
325
329
  # 如果要上传到根目录,直接使用源文件夹
326
330
  upload_path = str(folder_path)
@@ -337,6 +341,14 @@ def upload_folder(
337
341
  shutil.copytree(folder_path, target_path, dirs_exist_ok=True)
338
342
 
339
343
  upload_path = str(temp_path)
344
+ # 使用 Monkey Patch 方式临时修改 huggingface_hub 的默认超时配置
345
+ from huggingface_hub import constants as hf_constants
346
+
347
+ # 保存原始超时配置
348
+ original_timeout = hf_constants.DEFAULT_REQUEST_TIMEOUT
349
+
350
+ # 临时修改超时配置
351
+ hf_constants.DEFAULT_REQUEST_TIMEOUT = upload_timeout
340
352
 
341
353
  try:
342
354
  # 使用huggingface_hub的upload_folder上传
@@ -349,7 +361,7 @@ def upload_folder(
349
361
  )
350
362
 
351
363
  return result
352
-
364
+
353
365
  except Exception as e:
354
366
  error_msg = str(e)
355
367
  if "401" in error_msg or "403" in error_msg:
@@ -37,7 +37,7 @@ except ImportError:
37
37
 
38
38
 
39
39
  @click.group()
40
- @click.version_option(version='1.0.1')
40
+ @click.version_option(version='1.0.2')
41
41
  def cli():
42
42
  """AtomGit CLI - 基于Transformers和Hugging Face Hub的AtomGit平台模型文件上传下载工具"""
43
43
  pass
@@ -31,7 +31,7 @@ def read_requirements():
31
31
 
32
32
  setup(
33
33
  name='atomgit',
34
- version='1.0.1',
34
+ version='1.0.2',
35
35
  author='AtomGit CLI Team',
36
36
  author_email='sa@atomgit.com',
37
37
  description='AtomGit模型文件上传下载CLI工具',
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes