adam-community 1.0.26__tar.gz → 1.0.28__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.
- {adam_community-1.0.26 → adam_community-1.0.28}/PKG-INFO +1 -1
- adam_community-1.0.28/adam_community/__version__.py +1 -0
- {adam_community-1.0.26 → adam_community-1.0.28}/adam_community/cli/sif_build.py +15 -49
- {adam_community-1.0.26 → adam_community-1.0.28}/adam_community.egg-info/PKG-INFO +1 -1
- {adam_community-1.0.26 → adam_community-1.0.28}/test/test_sif_upload.py +2 -2
- adam_community-1.0.26/adam_community/__version__.py +0 -1
- {adam_community-1.0.26 → adam_community-1.0.28}/README.md +0 -0
- {adam_community-1.0.26 → adam_community-1.0.28}/adam_community/__init__.py +0 -0
- {adam_community-1.0.26 → adam_community-1.0.28}/adam_community/cli/__init__.py +0 -0
- {adam_community-1.0.26 → adam_community-1.0.28}/adam_community/cli/build.py +0 -0
- {adam_community-1.0.26 → adam_community-1.0.28}/adam_community/cli/cli.py +0 -0
- {adam_community-1.0.26 → adam_community-1.0.28}/adam_community/cli/init.py +0 -0
- {adam_community-1.0.26 → adam_community-1.0.28}/adam_community/cli/parser.py +0 -0
- {adam_community-1.0.26 → adam_community-1.0.28}/adam_community/cli/templates/Makefile.j2 +0 -0
- {adam_community-1.0.26 → adam_community-1.0.28}/adam_community/cli/templates/README_agent.md.j2 +0 -0
- {adam_community-1.0.26 → adam_community-1.0.28}/adam_community/cli/templates/README_kit.md.j2 +0 -0
- {adam_community-1.0.26 → adam_community-1.0.28}/adam_community/cli/templates/__init__.py +0 -0
- {adam_community-1.0.26 → adam_community-1.0.28}/adam_community/cli/templates/agent_python.py.j2 +0 -0
- {adam_community-1.0.26 → adam_community-1.0.28}/adam_community/cli/templates/configure.json.j2 +0 -0
- {adam_community-1.0.26 → adam_community-1.0.28}/adam_community/cli/templates/initial_assistant_message.md.j2 +0 -0
- {adam_community-1.0.26 → adam_community-1.0.28}/adam_community/cli/templates/initial_assistant_message_en.md.j2 +0 -0
- {adam_community-1.0.26 → adam_community-1.0.28}/adam_community/cli/templates/initial_system_prompt.md.j2 +0 -0
- {adam_community-1.0.26 → adam_community-1.0.28}/adam_community/cli/templates/initial_system_prompt_en.md.j2 +0 -0
- {adam_community-1.0.26 → adam_community-1.0.28}/adam_community/cli/templates/input.json.j2 +0 -0
- {adam_community-1.0.26 → adam_community-1.0.28}/adam_community/cli/templates/kit_python.py.j2 +0 -0
- {adam_community-1.0.26 → adam_community-1.0.28}/adam_community/cli/templates/long_description.md.j2 +0 -0
- {adam_community-1.0.26 → adam_community-1.0.28}/adam_community/cli/templates/long_description_en.md.j2 +0 -0
- {adam_community-1.0.26 → adam_community-1.0.28}/adam_community/cli/templates/rag_python.py.j2 +0 -0
- {adam_community-1.0.26 → adam_community-1.0.28}/adam_community/cli/updater.py +0 -0
- {adam_community-1.0.26 → adam_community-1.0.28}/adam_community/tool.py +0 -0
- {adam_community-1.0.26 → adam_community-1.0.28}/adam_community/util.py +0 -0
- {adam_community-1.0.26 → adam_community-1.0.28}/adam_community.egg-info/SOURCES.txt +0 -0
- {adam_community-1.0.26 → adam_community-1.0.28}/adam_community.egg-info/dependency_links.txt +0 -0
- {adam_community-1.0.26 → adam_community-1.0.28}/adam_community.egg-info/entry_points.txt +0 -0
- {adam_community-1.0.26 → adam_community-1.0.28}/adam_community.egg-info/requires.txt +0 -0
- {adam_community-1.0.26 → adam_community-1.0.28}/adam_community.egg-info/top_level.txt +0 -0
- {adam_community-1.0.26 → adam_community-1.0.28}/setup.cfg +0 -0
- {adam_community-1.0.26 → adam_community-1.0.28}/setup.py +0 -0
- {adam_community-1.0.26 → adam_community-1.0.28}/test/test_util_tool.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.0.28"
|
|
@@ -270,7 +270,8 @@ def generateDockerfile(work_dir: Path) -> Path:
|
|
|
270
270
|
"""
|
|
271
271
|
dockerfile_path = work_dir / "Dockerfile"
|
|
272
272
|
|
|
273
|
-
|
|
273
|
+
# 使用 DaoCloud 镜像加速,解决国内网络访问 Docker Hub 的问题
|
|
274
|
+
dockerfile_content = """FROM docker.m.daocloud.io/library/alpine
|
|
274
275
|
COPY . /sif
|
|
275
276
|
"""
|
|
276
277
|
|
|
@@ -409,18 +410,11 @@ def sif():
|
|
|
409
410
|
@click.argument('image_url')
|
|
410
411
|
@click.option('--username', help='Docker 仓库用户名')
|
|
411
412
|
@click.option('--password', help='Docker 仓库密码')
|
|
412
|
-
@click.option('--chunk-size', help='覆盖自适应计算的切片大小(如 100M, 500M)')
|
|
413
413
|
@click.option('--keep-temp', is_flag=True, help='保留临时文件')
|
|
414
|
-
def upload(sif_file, image_url, username, password,
|
|
415
|
-
"""将 SIF
|
|
414
|
+
def upload(sif_file, image_url, username, password, keep_temp):
|
|
415
|
+
"""将 SIF 文件打包为 Docker 镜像并推送到仓库
|
|
416
416
|
|
|
417
|
-
|
|
418
|
-
- 文件 < 500MB:不切片,直接使用原文件
|
|
419
|
-
- 文件 500MB-2GB:切片大小 100MB
|
|
420
|
-
- 文件 2GB-10GB:切片大小 500MB
|
|
421
|
-
- 文件 > 10GB:切片大小 1GB
|
|
422
|
-
|
|
423
|
-
可通过 --chunk-size 参数覆盖自适应策略
|
|
417
|
+
直接使用完整的 SIF 文件,不进行切片,避免合并问题。
|
|
424
418
|
|
|
425
419
|
示例:
|
|
426
420
|
adam-cli sif upload ./xxx.sif xxx.cn-hangzhou.cr.aliyuncs.com/openscore/openscore-core:1.0.0
|
|
@@ -443,7 +437,7 @@ def upload(sif_file, image_url, username, password, chunk_size, keep_temp):
|
|
|
443
437
|
|
|
444
438
|
try:
|
|
445
439
|
# ===== 步骤 1: 验证环境 =====
|
|
446
|
-
console.print("\n[bold blue]📦 步骤 1/
|
|
440
|
+
console.print("\n[bold blue]📦 步骤 1/4: 验证环境[/bold blue]")
|
|
447
441
|
|
|
448
442
|
# 验证 SIF 文件
|
|
449
443
|
valid, error_msg = validateSifFile(sif_path)
|
|
@@ -474,51 +468,24 @@ def upload(sif_file, image_url, username, password, chunk_size, keep_temp):
|
|
|
474
468
|
border_style="red"
|
|
475
469
|
))
|
|
476
470
|
sys.exit(1)
|
|
477
|
-
console.print(" ✓ split 命令可用")
|
|
478
471
|
console.print(" ✓ Docker 已安装并运行")
|
|
479
472
|
|
|
480
473
|
# ===== 步骤 2: 创建工作目录 =====
|
|
481
|
-
console.print("\n[bold blue]📦 步骤 2/
|
|
474
|
+
console.print("\n[bold blue]📦 步骤 2/4: 创建工作目录[/bold blue]")
|
|
482
475
|
work_dir = createWorkDir(sif_path)
|
|
483
476
|
console.print(f" ✓ 工作目录: {work_dir}")
|
|
484
477
|
|
|
485
|
-
# ===== 步骤 3:
|
|
486
|
-
console.print("\n[bold blue]📦 步骤 3/
|
|
487
|
-
|
|
488
|
-
# 计算切片大小
|
|
489
|
-
if chunk_size:
|
|
490
|
-
actual_chunk_size = chunk_size
|
|
491
|
-
console.print(f" 切片策略: 自定义 ({chunk_size})")
|
|
492
|
-
else:
|
|
493
|
-
actual_chunk_size = calculateOptimalChunkSize(file_size)
|
|
494
|
-
if actual_chunk_size:
|
|
495
|
-
console.print(f" 切片策略: 自适应 ({actual_chunk_size})")
|
|
496
|
-
else:
|
|
497
|
-
console.print(f" 切片策略: 不切片 (文件 < 500MB)")
|
|
478
|
+
# ===== 步骤 3: 复制 SIF 文件 =====
|
|
479
|
+
console.print("\n[bold blue]📦 步骤 3/4: 复制 SIF 文件[/bold blue]")
|
|
498
480
|
|
|
481
|
+
# 直接复制完整的 SIF 文件,不进行切片
|
|
482
|
+
dest_file = work_dir / sif_path.name
|
|
483
|
+
shutil.copy2(sif_path, dest_file)
|
|
484
|
+
console.print(f" ✓ SIF 文件已复制: {dest_file.name}")
|
|
499
485
|
console.print(f" 文件大小: {file_size_mb:.2f} MB")
|
|
500
486
|
|
|
501
|
-
# 执行切片
|
|
502
|
-
try:
|
|
503
|
-
chunks = splitSifFile(sif_path, actual_chunk_size, work_dir)
|
|
504
|
-
console.print(f" ✓ 切片完成: {len(chunks)} 个文件")
|
|
505
|
-
|
|
506
|
-
# 显示切片详情
|
|
507
|
-
console.print(f"\n 📄 切片详情:")
|
|
508
|
-
for chunk in chunks:
|
|
509
|
-
chunk_size_mb = chunk.stat().st_size / (1024 * 1024)
|
|
510
|
-
console.print(f" - {chunk.name} ({chunk_size_mb:.2f} MB)")
|
|
511
|
-
except subprocess.CalledProcessError as e:
|
|
512
|
-
console.print(Panel.fit(
|
|
513
|
-
f"[bold red]❌ SIF 文件切片失败[/bold red]\n"
|
|
514
|
-
f"错误: {e.stderr}",
|
|
515
|
-
border_style="red"
|
|
516
|
-
))
|
|
517
|
-
cleanupTempFiles(work_dir, keep_temp, console)
|
|
518
|
-
sys.exit(1)
|
|
519
|
-
|
|
520
487
|
# ===== 步骤 4: 生成 Dockerfile =====
|
|
521
|
-
console.print("\n[bold blue]📦 步骤 4/
|
|
488
|
+
console.print("\n[bold blue]📦 步骤 4/4: 生成 Dockerfile[/bold blue]")
|
|
522
489
|
dockerfile_path = generateDockerfile(work_dir)
|
|
523
490
|
console.print(f" ✓ Dockerfile 已生成")
|
|
524
491
|
|
|
@@ -553,8 +520,7 @@ def upload(sif_file, image_url, username, password, chunk_size, keep_temp):
|
|
|
553
520
|
console.print(Panel.fit(
|
|
554
521
|
f"[bold green]✅ 构建成功![/bold green]\n"
|
|
555
522
|
f"镜像: {image_url}\n"
|
|
556
|
-
f"大小: {file_size_mb:.2f} MB
|
|
557
|
-
f"切片数: {len(chunks)}",
|
|
523
|
+
f"大小: {file_size_mb:.2f} MB",
|
|
558
524
|
border_style="green"
|
|
559
525
|
))
|
|
560
526
|
|
|
@@ -330,7 +330,7 @@ class TestGenerateDockerfile(unittest.TestCase):
|
|
|
330
330
|
with open(dockerfile_path, 'r') as f:
|
|
331
331
|
content = f.read()
|
|
332
332
|
|
|
333
|
-
self.assertIn("FROM alpine", content)
|
|
333
|
+
self.assertIn("FROM docker.m.daocloud.io/library/alpine", content)
|
|
334
334
|
self.assertIn("COPY . /sif", content)
|
|
335
335
|
|
|
336
336
|
|
|
@@ -422,7 +422,7 @@ class TestIntegration(unittest.TestCase):
|
|
|
422
422
|
# 7. 验证 Dockerfile 内容
|
|
423
423
|
with open(dockerfile_path, 'r') as f:
|
|
424
424
|
content = f.read()
|
|
425
|
-
self.assertIn("FROM alpine", content)
|
|
425
|
+
self.assertIn("FROM docker.m.daocloud.io/library/alpine", content)
|
|
426
426
|
self.assertIn("COPY . /sif", content)
|
|
427
427
|
|
|
428
428
|
def test_chunk_size_boundaries(self):
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "1.0.26"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{adam_community-1.0.26 → adam_community-1.0.28}/adam_community/cli/templates/README_agent.md.j2
RENAMED
|
File without changes
|
{adam_community-1.0.26 → adam_community-1.0.28}/adam_community/cli/templates/README_kit.md.j2
RENAMED
|
File without changes
|
|
File without changes
|
{adam_community-1.0.26 → adam_community-1.0.28}/adam_community/cli/templates/agent_python.py.j2
RENAMED
|
File without changes
|
{adam_community-1.0.26 → adam_community-1.0.28}/adam_community/cli/templates/configure.json.j2
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{adam_community-1.0.26 → adam_community-1.0.28}/adam_community/cli/templates/kit_python.py.j2
RENAMED
|
File without changes
|
{adam_community-1.0.26 → adam_community-1.0.28}/adam_community/cli/templates/long_description.md.j2
RENAMED
|
File without changes
|
|
File without changes
|
{adam_community-1.0.26 → adam_community-1.0.28}/adam_community/cli/templates/rag_python.py.j2
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{adam_community-1.0.26 → adam_community-1.0.28}/adam_community.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|