refactor: 重构项目架构,移除YAML编排与旧注册系统

1.  将所有YAML配置的工具迁移到`@px.tool`装饰器实现
2.  拆分`llm`模块为`msdownload`和`sglang`子模块
3.  移除废弃的`registry.py`、`yaml_loader.py`和`yamlrun.py`模块
4.  清理项目依赖,移除PyYAML相关包
5.  更新文档与测试用例适配新架构
This commit is contained in:
2026-07-06 13:04:57 +08:00
parent 6da42ec5ff
commit f7fb95af83
29 changed files with 91 additions and 6345 deletions
+5 -5
View File
@@ -1,4 +1,4 @@
"""Tests for ops.dev 模块 envdev/dockercmd 函数 (镜像源配置/Docker 登录)."""
"""Tests for ops.envdev / ops.dockercmd 模块 (镜像源配置/Docker 登录)."""
from __future__ import annotations
@@ -9,8 +9,8 @@ from unittest.mock import MagicMock
import pytest
from pyflowx.conditions import Constants
from pyflowx.ops.dev import (
docker_login_tencent,
from pyflowx.ops.dockercmd import docker_login_tencent
from pyflowx.ops.envdev import (
download_rustup_script,
install_linux_docker,
install_linux_fonts,
@@ -123,10 +123,10 @@ class TestSetupRustMirror:
def test_creates_sccache_dir(self, monkeypatch: pytest.MonkeyPatch, tmp_path: Path) -> None:
"""应创建 sccache 缓存目录."""
from pyflowx.ops import dev as dev_module
from pyflowx.ops import envdev as envdev_module
fake_sccache = tmp_path / ".cargo" / "sccache"
monkeypatch.setattr(dev_module, "_RUST_SCCACHE_DIR", fake_sccache)
monkeypatch.setattr(envdev_module, "_RUST_SCCACHE_DIR", fake_sccache)
monkeypatch.setattr(Path, "home", lambda: tmp_path)
setup_rust_mirror("tsinghua")
assert fake_sccache.exists()
+1 -2
View File
@@ -154,6 +154,5 @@ class TestRegisteredFunctions:
"""Test that folderback functions are registered."""
def test_folderback_default_spec(self) -> None:
"""folderback_default should be a registered callable."""
# folderback_default 现在是通过 @px.register_fn 注册的普通函数, 不是 TaskSpec
"""folderback_default should be a callable function."""
assert callable(files.folderback_default)
+1 -2
View File
@@ -56,6 +56,5 @@ class TestRegisteredFunctions:
"""Test that folderzip functions are registered."""
def test_folderzip_default_spec(self) -> None:
"""folderzip_default should be a registered callable."""
# folderzip_default 现在是通过 @px.register_fn 注册的普通函数, 不是 TaskSpec
"""folderzip_default should be a callable function."""
assert callable(files.folderzip_default)
+1 -1
View File
@@ -8,7 +8,7 @@ from unittest.mock import patch
import pytest
import pyflowx as px
from pyflowx.ops import dev
from pyflowx.ops import gittool as dev
# ---------------------------------------------------------------------- #
+3 -2
View File
@@ -1,4 +1,4 @@
"""Tests for ops.llm 模块 (msdownload/sglang)."""
"""Tests for ops.msdownload / ops.sglang 模块 (ModelScope 下载/SGLang 服务)."""
from __future__ import annotations
@@ -9,7 +9,8 @@ from unittest.mock import MagicMock
import pytest
from pyflowx.conditions import Constants
from pyflowx.ops.llm import install_sglang, msdownload_run, run_sglang
from pyflowx.ops.msdownload import msdownload_run
from pyflowx.ops.sglang import install_sglang, run_sglang
# ---------------------------------------------------------------------- #