atomgit 1.0.0__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.
@@ -0,0 +1,583 @@
1
+ Metadata-Version: 2.4
2
+ Name: atomgit
3
+ Version: 1.0.0
4
+ Summary: AtomGit模型文件上传下载CLI工具
5
+ Home-page: https://atomgit.com/gitcode-ai/atomgit_cli
6
+ Author: AtomGit CLI Team
7
+ Author-email: sa@atomgit.com
8
+ Project-URL: Bug Reports, https://atomgit.com/gitcode-ai/atomgit_cli/issues
9
+ Project-URL: Source, https://atomgit.com/gitcode-ai/atomgit_cli
10
+ Keywords: transformers huggingface model dataset upload download cli
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.8
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
+ Classifier: Topic :: System :: Archiving
24
+ Classifier: Topic :: Utilities
25
+ Requires-Python: >=3.8
26
+ Description-Content-Type: text/markdown
27
+ Requires-Dist: click>=8.1.7
28
+ Requires-Dist: requests>=2.31.0
29
+ Requires-Dist: tqdm>=4.66.1
30
+ Requires-Dist: pathlib>=1.0.1
31
+ Requires-Dist: colorama>=0.4.6
32
+ Requires-Dist: tabulate>=0.9.0
33
+ Dynamic: author
34
+ Dynamic: author-email
35
+ Dynamic: classifier
36
+ Dynamic: description
37
+ Dynamic: description-content-type
38
+ Dynamic: home-page
39
+ Dynamic: keywords
40
+ Dynamic: project-url
41
+ Dynamic: requires-dist
42
+ Dynamic: requires-python
43
+ Dynamic: summary
44
+
45
+ # AtomGit CLI & SDK
46
+
47
+ 基于Transformers和Hugging Face Hub的AtomGit平台模型文件上传下载CLI工具和Python SDK
48
+
49
+ ## 简介
50
+
51
+ AtomGit 是一个完整的工具包,提供命令行工具(CLI)和Python SDK两种方式与AtomGit平台交互,支持模型和数据集的上传、下载等操作。类似于huggingface_hub,用户只需安装一个`atomgit`包即可同时使用CLI命令和Python编程接口。工具基于Transformers和Hugging Face Hub SDK开发,并配置为连接AtomGit API端点。
52
+
53
+ ## 功能特性
54
+
55
+ ### CLI功能
56
+ - 🔐 用户认证和登录管理
57
+ - 🔗 **Git集成**:自动配置Git凭证,支持标准Git命令
58
+ - 📁 支持模型和数据集仓库创建
59
+ - ⬆️ 文件和目录批量上传
60
+ - ⬇️ 仓库内容下载
61
+ - 🎨 彩色终端输出
62
+ - 📊 上传下载进度显示
63
+ - 🔧 配置文件管理
64
+
65
+ ### SDK功能
66
+ - 🐍 **Python原生接口**:类似huggingface_hub的API设计
67
+ - 🔄 **与CLI共享配置**:使用相同的认证和配置文件
68
+ - 📦 **一键安装**:安装atomgit包即可同时使用CLI和SDK
69
+ - 🚀 **完整API**:snapshot_download、upload_folder、create_repository等
70
+ - 📝 **完善的文档**:详细的使用示例和错误处理
71
+
72
+ ## 系统要求
73
+
74
+ - **Python 3.8+** (推荐Python 3.11+)
75
+ - 支持的操作系统:Windows, macOS, Linux
76
+
77
+ ## 安装
78
+
79
+ ### 从源码安装
80
+
81
+ ```bash
82
+ git clone https://atomgit.com/gitcode-ai/atomgit_cli.git
83
+ cd atomgit_cli
84
+ pip install -e .
85
+ ```
86
+
87
+ ### 使用pip安装(如果已发布)
88
+
89
+ ```bash
90
+ pip install atomgit
91
+ ```
92
+
93
+ ### 虚拟环境推荐
94
+
95
+ ```bash
96
+ # 创建虚拟环境
97
+ python -m venv venv
98
+
99
+ # 激活虚拟环境
100
+ source venv/bin/activate # Linux/macOS
101
+ # 或
102
+ venv\Scripts\activate # Windows
103
+
104
+ # 安装依赖
105
+ pip install -r requirements.txt
106
+ ```
107
+
108
+ ## 使用方法
109
+
110
+ ### 快速开始
111
+
112
+ #### CLI使用
113
+ ```bash
114
+ # 登录
115
+ atomgit login
116
+
117
+ # 下载模型
118
+ atomgit download wuyw/Qwen3-Reranker-0.6B-test -d ./models
119
+
120
+ # 上传文件
121
+ atomgit upload ./my-model --repo-id username/my-repo
122
+ ```
123
+
124
+ #### SDK使用
125
+ ```python
126
+ # 导入SDK
127
+ from atomgit_hub import snapshot_download
128
+
129
+ # 下载模型到本地目录
130
+ snapshot_download("wuyw/Qwen3-Reranker-0.6B-test", local_dir="./Qwen3-Reranker-0.6B-test")
131
+ ```
132
+
133
+ ### 1. 登录
134
+
135
+ 首先需要登录到AtomGit平台:
136
+
137
+ ```bash
138
+ atomgit login
139
+ ```
140
+
141
+ 系统会提示输入访问令牌(从AtomGit平台获取)。
142
+
143
+ **🎉 Git集成功能**:登录成功后,工具会自动配置Git凭证助手,这样你就可以直接使用标准的Git命令来操作AtomGit仓库,无需再次输入token。凭证助手会自动从AtomGit API获取你的真实用户名用于Git认证:
144
+
145
+ ```bash
146
+ # 登录后,这些Git命令将自动使用保存的token
147
+ # 支持两种域名格式
148
+ git clone https://atomgit.com/username/repo-name.git
149
+ git clone https://hub.atomgit.com/username/repo-name.git
150
+ git push origin main
151
+ git pull origin main
152
+ ```
153
+
154
+
155
+
156
+
157
+ ### 2. 上传文件
158
+
159
+ #### 上传模型
160
+
161
+ ```bash
162
+ atomgit upload ./your-model-dir --repo-id your-username/your-model-name
163
+ ```
164
+
165
+ #### 上传数据集
166
+
167
+ ```bash
168
+ atomgit upload ./your-dataset-dir --repo-id your-username/your-dataset-name
169
+ ```
170
+
171
+ #### 上传单个文件
172
+
173
+ ```bash
174
+ atomgit upload ./model.bin --repo-id your-username/your-model-name
175
+ ```
176
+
177
+ ### 3. 下载文件
178
+
179
+ #### 下载到当前目录
180
+
181
+ ```bash
182
+ atomgit download your-username/your-model-name
183
+ ```
184
+
185
+ #### 下载到指定目录
186
+
187
+ ```bash
188
+ atomgit download your-username/your-model-name -d ./models/
189
+ ```
190
+
191
+ ### 4. 其他命令
192
+
193
+ #### 退出登录
194
+
195
+ ```bash
196
+ atomgit logout
197
+ ```
198
+
199
+ #### 显示配置信息
200
+
201
+ ```bash
202
+ atomgit config-show
203
+ ```
204
+
205
+ ## SDK使用方法
206
+
207
+ AtomGit除了提供CLI工具外,还提供了类似huggingface_hub的Python SDK接口,让您可以在Python代码中直接使用AtomGit的功能。
208
+
209
+ ### SDK功能特性
210
+
211
+ - 🐍 **Python原生接口**:类似huggingface_hub的API设计
212
+ - 🔄 **与CLI共享配置**:使用相同的认证和配置文件
213
+ - 📦 **一键安装**:安装atomgit包即可同时使用CLI和SDK
214
+ - 🚀 **功能齐全**:支持上传、下载、仓库管理等完整功能
215
+
216
+ ### 1. SDK导入
217
+
218
+ ```python
219
+ # 推荐方式:直接从atomgit_hub导入
220
+ from atomgit_hub import snapshot_download
221
+
222
+ # 或者从atomgit包导入
223
+ from atomgit import snapshot_download
224
+
225
+ # 导入多个功能
226
+ from atomgit_hub import (
227
+ snapshot_download, # 下载整个仓库
228
+ download_file, # 下载单个文件
229
+ upload_folder, # 上传文件
230
+ create_repository # 创建仓库
231
+ )
232
+ ```
233
+
234
+ ### 2. SDK下载功能
235
+
236
+ #### 下载整个仓库(推荐用法)
237
+
238
+ ```python
239
+ from atomgit_hub import snapshot_download
240
+
241
+ # 基本用法:下载到指定目录
242
+ snapshot_download(
243
+ "wuyw/Qwen3-Reranker-0.6B-test",
244
+ local_dir="./Qwen3-Reranker-0.6B-test"
245
+ )
246
+
247
+ # 高级用法:更多参数控制
248
+ snapshot_download(
249
+ repo_id="username/model-name",
250
+ local_dir="./models/my-model",
251
+ revision="main", # 指定分支/标签
252
+ force_download=False, # 是否强制重新下载
253
+ allow_patterns=["*.py", "*.md"], # 只下载特定文件
254
+ ignore_patterns=["*.bin"], # 忽略特定文件
255
+ )
256
+ ```
257
+
258
+ #### 下载单个文件
259
+
260
+ ```python
261
+ from atomgit_hub import download_file
262
+
263
+ # 下载单个文件
264
+ file_path = download_file(
265
+ repo_id="username/repo-name",
266
+ filename="README.md",
267
+ local_dir="./downloads"
268
+ )
269
+ print(f"文件下载到: {file_path}")
270
+ ```
271
+
272
+ #### 获取文件下载URL
273
+
274
+ ```python
275
+ from atomgit_hub import hub_download_url
276
+
277
+ # 获取文件直接下载链接
278
+ url = hub_download_url(
279
+ repo_id="username/repo-name",
280
+ filename="model.bin",
281
+ revision="main"
282
+ )
283
+ print(f"下载链接: {url}")
284
+ ```
285
+
286
+ ### 3. SDK上传功能
287
+
288
+ #### 上传单个文件
289
+
290
+ ```python
291
+ from atomgit_hub import upload_folder
292
+
293
+ # 基本上传
294
+ upload_folder(
295
+ folder_path="./local-file.txt",
296
+ path_in_repo="remote-file.txt",
297
+ repo_id="username/repo-name",
298
+ commit_message="上传新文件"
299
+ )
300
+
301
+ # 上传到子目录
302
+ upload_folder(
303
+ folder_path="./model.bin",
304
+ path_in_repo="models/pytorch_model.bin",
305
+ repo_id="username/my-model",
306
+ commit_message="更新模型文件"
307
+ )
308
+ ```
309
+
310
+ #### 批量上传(使用CLI)
311
+
312
+ 对于目录批量上传,建议使用CLI命令:
313
+
314
+ ```python
315
+ import subprocess
316
+
317
+ # 通过SDK调用CLI命令进行批量上传
318
+ result = subprocess.run([
319
+ "atomgit", "upload", "./model-directory",
320
+ "--repo-id", "username/repo-name",
321
+ "--message", "上传完整模型"
322
+ ], capture_output=True, text=True)
323
+
324
+ if result.returncode == 0:
325
+ print("上传成功")
326
+ else:
327
+ print(f"上传失败: {result.stderr}")
328
+ ```
329
+
330
+ ### 4. 仓库管理
331
+
332
+ #### 创建新仓库
333
+
334
+ ```python
335
+ from atomgit_hub import create_repository
336
+
337
+ # 创建公开仓库
338
+ repo_url = create_repository(
339
+ repo_id="username/new-repo",
340
+ private=False,
341
+ repo_type="model" # 或 "dataset"
342
+ )
343
+ print(f"仓库创建成功: {repo_url}")
344
+
345
+ # 创建私有仓库
346
+ create_repository(
347
+ repo_id="username/private-repo",
348
+ private=True,
349
+ exist_ok=True # 如果已存在不报错
350
+ )
351
+ ```
352
+
353
+ ### 5. 认证管理
354
+
355
+ SDK与CLI共享相同的认证配置:
356
+
357
+ ```python
358
+ # 方法1:使用CLI登录(推荐)
359
+ # 在终端运行:atomgit login
360
+
361
+ # 方法2:在代码中直接提供token
362
+ from atomgit_hub import snapshot_download
363
+
364
+ snapshot_download(
365
+ "username/repo-name",
366
+ local_dir="./model",
367
+ token="your-access-token" # 直接传入token
368
+ )
369
+ ```
370
+
371
+ ### 6. 错误处理
372
+
373
+ ```python
374
+ from atomgit_hub import snapshot_download
375
+
376
+ try:
377
+ path = snapshot_download(
378
+ "username/repo-name",
379
+ local_dir="./model"
380
+ )
381
+ print(f"下载成功: {path}")
382
+ except Exception as e:
383
+ if "401" in str(e) or "403" in str(e):
384
+ print("认证失败,请先使用 'atomgit login' 登录")
385
+ elif "404" in str(e):
386
+ print("仓库不存在,请检查仓库名称")
387
+ else:
388
+ print(f"下载失败: {e}")
389
+ ```
390
+
391
+ ### 7. 完整示例
392
+
393
+ ```python
394
+ from atomgit_hub import (
395
+ snapshot_download,
396
+ upload_folder,
397
+ create_repository
398
+ )
399
+
400
+ def download_and_modify_model():
401
+ """下载模型,修改后重新上传的完整示例"""
402
+
403
+ # 1. 下载模型
404
+ print("正在下载模型...")
405
+ model_path = snapshot_download(
406
+ "source-user/original-model",
407
+ local_dir="./downloaded-model"
408
+ )
409
+
410
+ # 2. 创建新仓库
411
+ print("创建新仓库...")
412
+ create_repository(
413
+ repo_id="my-user/modified-model",
414
+ repo_type="model",
415
+ exist_ok=True
416
+ )
417
+
418
+ # 3. 修改模型文件(示例)
419
+ import os
420
+ readme_path = os.path.join(model_path, "README.md")
421
+ with open(readme_path, "a") as f:
422
+ f.write("\n\n## 修改说明\n\n这是基于原模型的修改版本。")
423
+
424
+ # 4. 上传修改后的文件
425
+ print("上传修改后的文件...")
426
+ upload_folder(
427
+ folder_path=readme_path,
428
+ path_in_repo="README.md",
429
+ repo_id="my-user/modified-model",
430
+ commit_message="更新README文档"
431
+ )
432
+
433
+ print("完成!")
434
+
435
+ # 运行示例
436
+ if __name__ == "__main__":
437
+ download_and_modify_model()
438
+ ```
439
+
440
+ ## 配置文件
441
+
442
+ 配置文件保存在 `~/.atomgit/config.json`,包含用户认证信息和其他设置。
443
+
444
+ ## API端点配置
445
+
446
+ 工具已预配置为连接AtomGit平台API端点:
447
+ - **API端点**:`https://hub.atomgit.com`
448
+ - **环境变量**:`HF_ENDPOINT=https://hub.atomgit.com`
449
+
450
+ 此配置在程序启动时自动设置,用户无需手动配置。
451
+
452
+ ## Git集成功能详解
453
+
454
+ ### 自动配置
455
+
456
+ 当你使用 `atomgit login` 登录成功后,工具会自动配置Git凭证,让你可以直接使用标准Git命令操作AtomGit仓库。
457
+
458
+ ### 支持的Git操作
459
+
460
+ 登录后,你可以直接使用以下Git命令,无需手动输入token:
461
+
462
+ ```bash
463
+ # 克隆仓库(支持两种域名格式)
464
+ git clone https://atomgit.com/username/repo-name.git
465
+ git clone https://hub.atomgit.com/username/repo-name.git
466
+
467
+ # 推送代码
468
+ git push origin main
469
+
470
+ # 拉取更新
471
+ git pull origin main
472
+
473
+ # 添加远程仓库
474
+ git remote add origin https://atomgit.com/username/repo-name.git
475
+ ```
476
+
477
+ ### 安全性
478
+
479
+ - 凭证配置仅对 `atomgit.com` 和 `hub.atomgit.com` 域名生效
480
+ - token 安全存储在本地配置文件中
481
+ - 不影响其他Git仓库的认证配置
482
+ - `atomgit logout` 时自动清除凭证配置
483
+
484
+ ### 注意事项
485
+
486
+ - 支持的URL格式:`https://atomgit.com/...` 或 `https://hub.atomgit.com/...`
487
+ - 如果Git命令仍需要输入密码,请重新登录:`atomgit logout` 然后 `atomgit login`
488
+
489
+ ## 错误处理
490
+
491
+ - 如果遇到网络错误,工具会自动重试
492
+ - 上传大文件时会显示进度条
493
+ - 所有操作都有详细的错误信息提示
494
+
495
+ ## 支持的文件类型
496
+
497
+ - 支持所有文件类型的上传和下载
498
+ - 自动处理目录结构
499
+ - 支持大文件传输
500
+
501
+ ## 开发
502
+
503
+ ### 项目结构
504
+
505
+ ```
506
+ atomgit/
507
+ ├── __init__.py # 包初始化,导出SDK接口
508
+ ├── __main__.py # 主入口
509
+ ├── cli.py # CLI命令定义
510
+ ├── api.py # Hugging Face Hub API客户端
511
+ ├── config.py # 配置管理
512
+ ├── utils.py # 工具函数
513
+ ├── atomgit_hub.py # Python SDK接口
514
+ ├── requirements.txt # 依赖包
515
+ ├── setup.py # 包安装配置
516
+ └── README.md # 说明文档
517
+ ```
518
+
519
+ ### 本地开发
520
+
521
+ ```bash
522
+ # 克隆项目
523
+ git clone https://atomgit.com/gitcode-ai/atomgit_cli.git
524
+ cd atomgit_cli
525
+
526
+ # 安装依赖
527
+ pip install -r requirements.txt
528
+
529
+ # 开发模式安装
530
+ pip install -e .
531
+
532
+ # 测试CLI功能
533
+ atomgit --help
534
+
535
+ # 测试SDK功能
536
+ python -c "from atomgit_hub import snapshot_download; print('SDK导入成功')"
537
+
538
+ # 运行测试
539
+ python -m pytest tests/
540
+ ```
541
+
542
+ ## Python版本兼容性
543
+
544
+ 本项目支持Python 3.8+版本,包括:
545
+
546
+ - ✅ Python 3.8
547
+ - ✅ Python 3.9
548
+ - ✅ Python 3.10
549
+ - ✅ Python 3.11
550
+ - ✅ Python 3.12
551
+ - ✅ Python 3.13
552
+
553
+ ### 兼容性测试
554
+
555
+ 运行兼容性测试:
556
+
557
+ ```bash
558
+ python test_compatibility.py
559
+ ```
560
+
561
+ 详细兼容性信息请参考 [PYTHON_COMPATIBILITY.md](PYTHON_COMPATIBILITY.md)
562
+
563
+ ## 许可证
564
+
565
+ MIT License
566
+
567
+ ## 贡献
568
+
569
+ 欢迎提交Issue和Pull Request!
570
+
571
+ ### 贡献指南
572
+
573
+ 在贡献代码时,请确保:
574
+
575
+ 1. 代码兼容Python 3.8+
576
+ 2. 运行兼容性测试
577
+ 3. 更新相关文档
578
+
579
+ ## 联系我们
580
+
581
+ - 邮箱:support@atomgit.com
582
+ - 项目地址:https://atomgit.com/gitcode-ai/atomgit_cli
583
+ - 问题报告:https://atomgit.com/gitcode-ai/atomgit_cli/issues
@@ -0,0 +1,13 @@
1
+ atomgit_hub.py,sha256=nULkoBtMtDsVYFjDnH6oXkXqSw4F4bpQLRorUugvUh0,17617
2
+ atomgit/__init__.py,sha256=yjCFaamb9TvCpOr5scllBQxNoclciufkZVAWL7dFvyU,984
3
+ atomgit/__main__.py,sha256=Ppv7KJK3khzwr26xukd7LjCCFz_Lnih8Af_dD4d8COQ,254
4
+ atomgit/api.py,sha256=_vpTsPgm51HLPfIo2UHhrIvdkC-9I1j3tVIhLirzNm4,11757
5
+ atomgit/atomgit_hub.py,sha256=nULkoBtMtDsVYFjDnH6oXkXqSw4F4bpQLRorUugvUh0,17617
6
+ atomgit/cli.py,sha256=5f5qq7Qr5YyPZK4fHtin40KkOcuAejt_kxWmFZNK-cE,9914
7
+ atomgit/config.py,sha256=DFlVuatCw3RIZOPb0Ieav2Q2lu1GdBzDUjUURJl1trM,2133
8
+ atomgit/utils.py,sha256=5ZcFin1z6Uk2Ql7cmJ49XATvumPekeY040toQBgAUZE,10318
9
+ atomgit-1.0.0.dist-info/METADATA,sha256=2uLReatofiBARpp1brNKdFlRXaKqQpl_5ZZLFjnVsnM,13841
10
+ atomgit-1.0.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
11
+ atomgit-1.0.0.dist-info/entry_points.txt,sha256=4J6yNaGQKJ-XLc2vdIRGy7DZFddV1VDhzzx7egYIw48,44
12
+ atomgit-1.0.0.dist-info/top_level.txt,sha256=PHcnLHaq4F9bQ3b7rFwfAAvTnj8ysRCIZ8Cy6UGsDoY,20
13
+ atomgit-1.0.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ atomgit = atomgit.cli:cli
@@ -0,0 +1,2 @@
1
+ atomgit
2
+ atomgit_hub