atomgit 1.0.0__tar.gz → 1.0.1__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.
- {atomgit-1.0.0 → atomgit-1.0.1}/PKG-INFO +1 -1
- {atomgit-1.0.0 → atomgit-1.0.1}/__init__.py +1 -1
- {atomgit-1.0.0 → atomgit-1.0.1}/atomgit.egg-info/PKG-INFO +1 -1
- {atomgit-1.0.0 → atomgit-1.0.1}/atomgit.egg-info/SOURCES.txt +2 -0
- {atomgit-1.0.0 → atomgit-1.0.1}/atomgit_hub.py +4 -1
- {atomgit-1.0.0 → atomgit-1.0.1}/cli.py +1 -1
- {atomgit-1.0.0 → atomgit-1.0.1}/setup.py +4 -2
- atomgit-1.0.1/test.py +152 -0
- {atomgit-1.0.0 → atomgit-1.0.1}/README.md +0 -0
- {atomgit-1.0.0 → atomgit-1.0.1}/__main__.py +0 -0
- {atomgit-1.0.0 → atomgit-1.0.1}/api.py +0 -0
- {atomgit-1.0.0 → atomgit-1.0.1}/atomgit.egg-info/dependency_links.txt +0 -0
- {atomgit-1.0.0 → atomgit-1.0.1}/atomgit.egg-info/entry_points.txt +0 -0
- {atomgit-1.0.0 → atomgit-1.0.1}/atomgit.egg-info/requires.txt +0 -0
- {atomgit-1.0.0 → atomgit-1.0.1}/atomgit.egg-info/top_level.txt +0 -0
- {atomgit-1.0.0 → atomgit-1.0.1}/config.py +0 -0
- {atomgit-1.0.0 → atomgit-1.0.1}/setup.cfg +0 -0
- {atomgit-1.0.0 → atomgit-1.0.1}/utils.py +0 -0
|
@@ -6,6 +6,7 @@ atomgit_hub.py
|
|
|
6
6
|
cli.py
|
|
7
7
|
config.py
|
|
8
8
|
setup.py
|
|
9
|
+
test.py
|
|
9
10
|
utils.py
|
|
10
11
|
./__init__.py
|
|
11
12
|
./__main__.py
|
|
@@ -13,6 +14,7 @@ utils.py
|
|
|
13
14
|
./atomgit_hub.py
|
|
14
15
|
./cli.py
|
|
15
16
|
./config.py
|
|
17
|
+
./test.py
|
|
16
18
|
./utils.py
|
|
17
19
|
atomgit.egg-info/PKG-INFO
|
|
18
20
|
atomgit.egg-info/SOURCES.txt
|
|
@@ -35,7 +35,10 @@ except ImportError:
|
|
|
35
35
|
try:
|
|
36
36
|
from .config import config
|
|
37
37
|
except ImportError:
|
|
38
|
-
|
|
38
|
+
try:
|
|
39
|
+
from config import config
|
|
40
|
+
except ImportError:
|
|
41
|
+
from atomgit.config import config
|
|
39
42
|
|
|
40
43
|
|
|
41
44
|
def _normalize_repo_id(repo_id: str) -> str:
|
|
@@ -24,12 +24,14 @@ def read_requirements():
|
|
|
24
24
|
'tqdm>=4.66.1',
|
|
25
25
|
'pathlib>=1.0.1',
|
|
26
26
|
'colorama>=0.4.6',
|
|
27
|
-
'tabulate>=0.9.0'
|
|
27
|
+
'tabulate>=0.9.0',
|
|
28
|
+
'huggingface-hub>=0.20.0',
|
|
29
|
+
'datasets>=2.16.0'
|
|
28
30
|
]
|
|
29
31
|
|
|
30
32
|
setup(
|
|
31
33
|
name='atomgit',
|
|
32
|
-
version='1.0.
|
|
34
|
+
version='1.0.1',
|
|
33
35
|
author='AtomGit CLI Team',
|
|
34
36
|
author_email='sa@atomgit.com',
|
|
35
37
|
description='AtomGit模型文件上传下载CLI工具',
|
atomgit-1.0.1/test.py
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""
|
|
4
|
+
AtomGit Hub 功能测试
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from atomgit_hub import (
|
|
8
|
+
create_repository,
|
|
9
|
+
upload_folder,
|
|
10
|
+
snapshot_download,
|
|
11
|
+
hub_download_url,
|
|
12
|
+
download_file,
|
|
13
|
+
load_dataset
|
|
14
|
+
)
|
|
15
|
+
from pathlib import Path
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def test_create_model(repo_id: str, repo_type: str):
|
|
19
|
+
print("\n=== 测试 create_repository ===")
|
|
20
|
+
try:
|
|
21
|
+
result = create_repository(
|
|
22
|
+
repo_id=repo_id,
|
|
23
|
+
token=None, # 使用保存的token
|
|
24
|
+
private=True,
|
|
25
|
+
repo_type=repo_type,
|
|
26
|
+
exist_ok=True,
|
|
27
|
+
space_sdk=None,
|
|
28
|
+
space_hardware=None,
|
|
29
|
+
space_storage=None,
|
|
30
|
+
space_sleep_time=None,
|
|
31
|
+
space_secrets=None,
|
|
32
|
+
space_variables=None
|
|
33
|
+
)
|
|
34
|
+
print(f"✅ 创建仓库成功: {result}")
|
|
35
|
+
except Exception as e:
|
|
36
|
+
print(f"❌ 创建仓库失败: {e}")
|
|
37
|
+
|
|
38
|
+
def test_upload_folder(repo_id: str, folder_path: str):
|
|
39
|
+
print("\n=== 测试 upload_folder ===")
|
|
40
|
+
|
|
41
|
+
try:
|
|
42
|
+
result = upload_folder(
|
|
43
|
+
folder_path=folder_path,
|
|
44
|
+
repo_id=repo_id,
|
|
45
|
+
token=None, # 使用保存的token
|
|
46
|
+
commit_message="Test upload with all parameters",
|
|
47
|
+
commit_description="Full parameter test for upload_folder function"
|
|
48
|
+
)
|
|
49
|
+
print(f"✅ 上传文件夹成功: {result}")
|
|
50
|
+
except Exception as e:
|
|
51
|
+
print(f"❌ 上传文件夹失败: {e}")
|
|
52
|
+
|
|
53
|
+
def test_snapshot_download(repo_id: str, local_dir: str):
|
|
54
|
+
print("\n=== 测试 snapshot_download ===")
|
|
55
|
+
try:
|
|
56
|
+
local_path = snapshot_download(
|
|
57
|
+
repo_id=repo_id,
|
|
58
|
+
local_dir=local_dir,
|
|
59
|
+
proxies=None,
|
|
60
|
+
etag_timeout=10,
|
|
61
|
+
resume_download=False,
|
|
62
|
+
force_download=True,
|
|
63
|
+
token=None, # 使用保存的token
|
|
64
|
+
local_files_only=False,
|
|
65
|
+
max_workers=8,
|
|
66
|
+
tqdm_class=None
|
|
67
|
+
)
|
|
68
|
+
print(f"✅ 下载快照成功: {local_path}")
|
|
69
|
+
except Exception as e:
|
|
70
|
+
print(f"❌ 下载快照失败: {e}")
|
|
71
|
+
|
|
72
|
+
def test_download_file(repo_id: str, filename: str, local_dir: str):
|
|
73
|
+
print("\n=== 测试 download_file ===")
|
|
74
|
+
try:
|
|
75
|
+
file_path = download_file(
|
|
76
|
+
repo_id=repo_id,
|
|
77
|
+
filename=filename,
|
|
78
|
+
local_dir=local_dir,
|
|
79
|
+
token=None, # 使用保存的token
|
|
80
|
+
force_download=True
|
|
81
|
+
)
|
|
82
|
+
print(f"✅ 下载文件成功: {file_path}")
|
|
83
|
+
except Exception as e:
|
|
84
|
+
print(f"❌ 下载文件失败: {e}")
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def test_hub_download_url(repo_id: str, filename: str, repo_type: str):
|
|
88
|
+
print("\n=== 测试 hub_download_url ===")
|
|
89
|
+
try:
|
|
90
|
+
url = hub_download_url(
|
|
91
|
+
repo_id=repo_id,
|
|
92
|
+
filename=filename,
|
|
93
|
+
repo_type=repo_type
|
|
94
|
+
)
|
|
95
|
+
print(f"✅ 获取URL成功: {url}")
|
|
96
|
+
except Exception as e:
|
|
97
|
+
print(f"❌ 获取URL失败: {e}")
|
|
98
|
+
|
|
99
|
+
def test_load_dataset(repo_id: str, local_dir: str):
|
|
100
|
+
print("\n=== 测试 load_dataset ===")
|
|
101
|
+
try:
|
|
102
|
+
dataset = load_dataset(
|
|
103
|
+
path=repo_id,
|
|
104
|
+
cache_dir=local_dir,
|
|
105
|
+
token=None
|
|
106
|
+
)
|
|
107
|
+
print(f"✅ 加载数据集成功: {dataset}")
|
|
108
|
+
except Exception as e:
|
|
109
|
+
print(f"❌ 加载数据集失败: {e}")
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
def run_all_tests():
|
|
113
|
+
"""运行所有测试"""
|
|
114
|
+
print("=" * 60)
|
|
115
|
+
print("开始运行 AtomGit Hub 完整参数测试")
|
|
116
|
+
print("=" * 60)
|
|
117
|
+
model = "ai-test/atomgit-cli-test-model-full"
|
|
118
|
+
dataset = "ai-test/atomgit-cli-test-dataset-full"
|
|
119
|
+
|
|
120
|
+
model_folder_path="/Users/yanlp/csdn/aipython/gitcode_cli/site/yanlp-model-1"
|
|
121
|
+
dataset_folder_path="/Users/yanlp/csdn/aipython/gitcode_cli/site/yanlp-model-1"
|
|
122
|
+
|
|
123
|
+
test_dataset = "yanlp/glaive_toolcall_zh"
|
|
124
|
+
# 注意:按照依赖顺序执行测试
|
|
125
|
+
# 1. 先创建仓库
|
|
126
|
+
# test_create_model(repo_id=model, repo_type="model")
|
|
127
|
+
# test_create_model(repo_id=dataset, repo_type="dataset")
|
|
128
|
+
|
|
129
|
+
# 2. 测试upload
|
|
130
|
+
# test_upload_folder(repo_id=model, folder_path=model_folder_path)
|
|
131
|
+
# test_upload_folder(repo_id=dataset, folder_path=dataset_folder_path)
|
|
132
|
+
|
|
133
|
+
# 3. 测试下载
|
|
134
|
+
test_snapshot_download(repo_id=model, local_dir="./test_downloads/model/snapshot_full")
|
|
135
|
+
# test_snapshot_download(repo_id="hf_mirrors/Qwen/Qwen3-0.6B", local_dir="./test_downloads/dataset/snapshot_full2")
|
|
136
|
+
|
|
137
|
+
# 4. 测试下载文件
|
|
138
|
+
# test_download_file(repo_id=model, filename="README.md", local_dir="./test_downloads/model/single_file")
|
|
139
|
+
|
|
140
|
+
# 5. 测试URL获取
|
|
141
|
+
# test_hub_download_url(repo_id=model, filename="model.safetensors", repo_type="model")
|
|
142
|
+
|
|
143
|
+
# 6. 测试数据集加载
|
|
144
|
+
# test_load_dataset(repo_id=test_dataset, local_dir="./test_downloads/dataset/load_dataset")
|
|
145
|
+
|
|
146
|
+
print("\n" + "=" * 60)
|
|
147
|
+
print("所有测试完成")
|
|
148
|
+
print("=" * 60)
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
if __name__ == "__main__":
|
|
152
|
+
run_all_tests()
|
|
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
|