atomgit 1.0.6__tar.gz → 1.0.7__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.6
3
+ Version: 1.0.7
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.6'
11
+ __version__ = '1.0.7'
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.6
3
+ Version: 1.0.7
4
4
  Summary: AtomGit模型文件上传下载CLI工具
5
5
  Home-page: https://atomgit.com/gitcode-ai/atomgit_cli
6
6
  Author: AtomGit CLI Team
@@ -26,7 +26,10 @@ from huggingface_hub import hf_hub_download, upload_folder as hf_upload_folder,
26
26
  try:
27
27
  from .rate_limiter import install_hf_rate_limiter
28
28
  except ImportError:
29
- from rate_limiter import install_hf_rate_limiter
29
+ try:
30
+ from rate_limiter import install_hf_rate_limiter
31
+ except ImportError:
32
+ from atomgit.rate_limiter import install_hf_rate_limiter
30
33
 
31
34
  install_hf_rate_limiter()
32
35
 
@@ -337,8 +340,10 @@ def upload_folder(
337
340
  # 如果要上传到根目录,直接使用源文件夹
338
341
  upload_path = str(folder_path)
339
342
  else:
340
- # 如果要上传到特定路径,需要重新组织目录结构
341
- with tempfile.TemporaryDirectory() as temp_dir:
343
+ # 如果要上传到特定路径,需要重新组织目录结构。
344
+ # 注意:不能提前退出 with TemporaryDirectory(),否则上传时临时目录已被删除。
345
+ temp_dir = tempfile.mkdtemp(prefix="atomgit_upload_")
346
+ try:
342
347
  temp_path = Path(temp_dir)
343
348
 
344
349
  # 创建目标路径
@@ -348,7 +353,11 @@ def upload_folder(
348
353
  # 复制整个目录树
349
354
  shutil.copytree(folder_path, target_path, dirs_exist_ok=True)
350
355
 
351
- upload_path = str(temp_path)
356
+ except Exception:
357
+ shutil.rmtree(temp_dir, ignore_errors=True)
358
+ raise
359
+
360
+ upload_path = str(temp_path)
352
361
  # 使用 Monkey Patch 方式临时修改 huggingface_hub 的默认超时配置
353
362
  from huggingface_hub import constants as hf_constants
354
363
 
@@ -378,6 +387,10 @@ def upload_folder(
378
387
  raise Exception(f"仓库不存在:{repo_id}")
379
388
  else:
380
389
  raise Exception(f"上传失败:{error_msg}")
390
+ finally:
391
+ # 清理临时目录(仅重新组织目录结构时创建)
392
+ if path_in_repo not in ("./", ".", ""):
393
+ shutil.rmtree(temp_dir, ignore_errors=True)
381
394
 
382
395
 
383
396
  def create_repository(
@@ -39,7 +39,7 @@ except ImportError:
39
39
 
40
40
 
41
41
  @click.group()
42
- @click.version_option(version='1.0.6')
42
+ @click.version_option(version='1.0.7')
43
43
  def cli():
44
44
  """AtomGit CLI - 基于Transformers和Hugging Face Hub的AtomGit平台模型文件上传下载工具"""
45
45
  pass
@@ -31,7 +31,7 @@ def read_requirements():
31
31
 
32
32
  setup(
33
33
  name='atomgit',
34
- version='1.0.6',
34
+ version='1.0.7',
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
File without changes
File without changes
File without changes