chore: Update BlendJob wheel to version 0.1.6 and adjust related documentation
Some checks failed
构建扩展 / build (push) Failing after 11m45s

This commit is contained in:
2026-08-17 16:45:29 +08:00
parent 1c98b21235
commit fb78a8068b
9 changed files with 28 additions and 21 deletions

View File

@@ -84,7 +84,7 @@ Session 逐帧推理,显存峰值不随视频帧数平方增长;Debug 多帧
## 常见问题
- 从 0.12.0–0.12.2 升级到 0.12.3 后,请重新执行一次 `Install Environment`,让 Storage Root 中的 Environment 安装修复后的 BlendJob wheel
- 从 0.12.0–0.12.2 升级到 0.12.3 后,请重新执行一次 `Install Environment`,让 Storage Root 中的 Environment 更新 BlendJob 运行依赖
- 首次使用需要下载模型,如果下载慢或失败,可在 Image Empty 的 `SnapForm` 右键菜单点击
`Download Required Models`,也可在 `Models` panel 里逐项重试
- 安装 Environment 时 uv 下载失败会自动尝试 OmooLab 镜像;Python packages 需要指定镜像时设置

View File

@@ -22,7 +22,7 @@ flowchart LR
- `panel.py`、`preferences.py`、`properties.py` 只描述 UI 和 Blender 属性,不直接导入 Server 模型实现
- `operators.py` 将 Blender 状态转换为普通字典参数;Job 完成后在主线程导入图片、网格、材质和相机
- `blender/depth_plane.py` 与 `blender/surface.py` 实现 Image Empty 输入检查、几何构建和资产挂载
- `job_runtime.py` 以入口字符串声明独立 Server,并配置 Environment、Storage Root、BlendJob wheel 与首次安装后的推荐模型下载
- `job_runtime.py` 以入口字符串声明独立 Server,并配置 Environment、Storage Root 与首次安装后的推荐模型下载
- `server/__init__.py` 创建 `JobServer`、注册公开 Job,并把 `ModelManager` 注册为 Resource
- `server/media.py`、`background.py`、`da3.py`、`moge2.py` 负责业务流程;`onnx_*.py` 只处理模型输入、推理和输出恢复
- 根目录 `model_catalog.py` 是 Blender UI 与独立 Server 共用的纯数据声明;`server/model_download.py`、`server/model_manager.py` 分别负责下载和 Session 生命周期
@@ -68,7 +68,7 @@ flowchart LR
│ │ ├── onnx_moge2.py
│ │ └── onnx_runtime.py
│ └── wheels/
│ └── blendjob-0.1.5-py3-none-any.whl
│ └── blendjob-0.1.6-py3-none-any.whl
├── tests/
└── tools/
```
@@ -84,7 +84,7 @@ uv run pytest tests/test_addon.py tests/test_manifest.py tests/test_pack.py -v
uv run python pack.py
```
`pack.py` 根据 `blender_manifest.toml` 分别生成 Windows、macOS 和 Linux 扩展包,例如 `dist/SnapForm.v0.12.3.windows-x64.zip`。更改 `src/snapform/wheels/` 中的本地 wheel 后,先刷新锁文件再测试:
`pack.py` 根据 `blender_manifest.toml` 分别生成 Windows、macOS 和 Linux 扩展包,例如 `dist/SnapForm.v0.12.3.windows-x64.zip`。从 PyPI 下载并更换 `src/snapform/wheels/` 中随扩展分发的 wheel 后,先刷新锁文件再测试:
```bash
uv lock --refresh

View File

@@ -22,12 +22,12 @@ Environment、模型和任务结果默认保存在 `~/.snapform`:
不同 Blender 版本可共享此目录。也可以在 Extension Preferences 的 `Storage Root` 中修改位置。连接端口与 Instance ID 只保存在启动它们的 Blender 进程内存中。
通用 HTTP 层由 `src/snapform/wheels/` 中的 BlendJob package 提供。`JobServer` 包装 FastAPI 并提供 Job、FIFO Queue 与 Resource API,`JobClient` 是无第三方依赖的 Blender 侧访问器。Blender 侧只把 `server/__init__.py:server` 入口字符串交给 Runtime,不导入 `server` package;独立进程启动后才取得其中的 `server` 实例、注册全部公开 Job,并创建 `model_manager` Resource。
Blender 侧的通用 HTTP Runtime 由 `src/snapform/wheels/` 中随扩展分发的 BlendJob package 提供;独立 Environment 由 Runtime 从 PyPI 自动安装相同版本。`JobServer` 包装 FastAPI 并提供 Job、FIFO Queue 与 Resource API,`JobClient` 是无第三方依赖的 Blender 侧访问器。Blender 侧只把 `server/__init__.py:server` 入口字符串交给 Runtime,不导入 `server` package;独立进程启动后才取得其中的 `server` 实例、注册全部公开 Job,并创建 `model_manager` Resource。
SnapForm 根 package 不再有 `client.py`、`environment.py`、`storage.py` 或 `models.py`。这些文件会制造并不存在的业务边界:
- Storage Root、`.venv`、Manifest、安装状态与日志路径由 `JobRuntime` 唯一管理;
- `InstallEnvironment` 由 `runtime.operator_classes()` 提供,Python 与 packages 直接声明在传给 Runtime 的 `environment` 字典中;
- `InstallEnvironment` 由 `runtime.operator_classes()` 提供,Python 与 Job 自身的额外 packages 直接声明在传给 Runtime 的 `environment` 字典中;BlendJob 不需要重复声明;
- 模型 catalog 由 `model_catalog.py` 统一声明;下载和 ONNX Session 属于 Server,分别位于 `model_download.py` 与 `model_manager.py`;
- Blender UI 复用同一 catalog,直接检查 Storage Root 下的模型必需文件,不为显示下载状态启动 Server;已加载 Session 状态仍读取现有 Server Snapshot。
@@ -57,13 +57,13 @@ Server 端没有 `execute_*`、`*_result` 或 CLI worker 中转。全部 `@serve
- ONNX Runtime 1.24.4;Windows 使用 `onnxruntime-directml`
- NumPy 2.4.2、Pillow 12.1.1、PyAV 17.0.0、trimesh 4.11.2
- FastAPI 0.139.2、Uvicorn 0.51.0、huggingface-hub 1.4.1
- BlendJob 0.1.6、FastAPI 0.139.2、Uvicorn 0.51.0、huggingface-hub 1.4.1
运行环境不安装 PyTorch、TorchVision、xFormers,也不安装 DA3、MoGe、BEN2 或 utils3d 的 Python 源码包。模型推理和 SnapForm 所需的相机、点云、网格后处理均由 ONNX Runtime、NumPy 与内部实现完成。
Windows 当前发行环境提供 DirectML 与 CPU;`Auto` 优先使用 `DmlExecutionProvider`。显式指定不可用设备时会安全回退到 CPU。其他平台安装标准 ONNX Runtime,并按可用 provider 选择 CoreML、OpenVINO 或 CPU。
`environment.json` 保存规范化后的声明,`manifest.json` 保存该声明、BlendJob wheel 与基础 Server packages 的 Hash。Python、packages、平台 packages 或 Environment Schema 改变后需要重新执行 `Install Environment`,不再维护手工 Manifest Revision。
`environment.json` 保存规范化后的声明,`manifest.json` 保存该声明、BlendJob 版本与基础 Server packages 的 Hash。Python、packages、平台 packages、BlendJob 版本或 Environment Schema 改变后需要重新执行 `Install Environment`,不再维护手工 Manifest Revision。
## 模型

View File

@@ -14,4 +14,4 @@ dev = ["numpy", "pillow", "pytest"]
package = false
[tool.uv.sources]
blendjob = { path = "src/snapform/wheels/blendjob-0.1.5-py3-none-any.whl" }
blendjob = { path = "src/snapform/wheels/blendjob-0.1.6-py3-none-any.whl" }

View File

@@ -10,7 +10,7 @@ type = "add-on"
blender_version_min = "4.5.0"
platforms = ["windows-x64", "macos-arm64", "linux-x64"]
license = ["SPDX:GPL-3.0-or-later"]
wheels = ["./wheels/blendjob-0.1.5-py3-none-any.whl"]
wheels = ["./wheels/blendjob-0.1.6-py3-none-any.whl"]
[permissions]
network = "Access the local Job Server and download environment dependencies and model weights"

View File

@@ -6,11 +6,6 @@ from blendjob import JobRuntime
DEFAULT_STORAGE_ROOT = Path.home() / ".snapform"
BLENDJOB_WHEEL = (
Path(__file__).resolve().parent
/ "wheels"
/ "blendjob-0.1.5-py3-none-any.whl"
)
def configured_storage_root():
@@ -24,7 +19,6 @@ def configured_storage_root():
ENVIRONMENT = {
"python": "3.12",
"packages": [
str(BLENDJOB_WHEEL),
"numpy==2.4.2",
"pillow==12.1.1",
"av==17.0.0",

View File

@@ -267,6 +267,12 @@ class AddonTest(unittest.TestCase):
runtime = self.addon.runtime
self.assertEqual(runtime.environment["python"], "3.12")
self.assertIn("numpy==2.4.2", runtime.environment["packages"])
self.assertFalse(
any(
"blendjob" in package.lower()
for package in runtime.environment["packages"]
)
)
self.assertTrue(callable(runtime.post_install))
def test_snapform_post_install_is_ordinary_code_using_runtime_request(self):

View File

@@ -73,7 +73,7 @@ class PackTest(unittest.TestCase):
self.assertNotIn("server/jobs.py", names)
self.assertIn("server/__init__.py", names)
self.assertIn(
"wheels/blendjob-0.1.5-py3-none-any.whl",
"wheels/blendjob-0.1.6-py3-none-any.whl",
names,
)
self.assertFalse(

15
uv.lock generated
View File

@@ -8,12 +8,19 @@ resolution-markers = [
[[package]]
name = "blendjob"
version = "0.1.5"
source = { path = "src/snapform/wheels/blendjob-0.1.5-py3-none-any.whl" }
version = "0.1.6"
source = { path = "src/snapform/wheels/blendjob-0.1.6-py3-none-any.whl" }
wheels = [
{ filename = "blendjob-0.1.5-py3-none-any.whl", hash = "sha256:5d745d057ef051c2b76c4bd6423eab3c99aba7619d2d7f561713448e7be729c0" },
{ filename = "blendjob-0.1.6-py3-none-any.whl", hash = "sha256:ed7c0ee4a0c952c25a7b6606bcd860b5c782ecb04ae6f9e7b1c475a03ab9c6b1" },
]
[package.metadata]
requires-dist = [
{ name = "fastapi", marker = "extra == 'server'", specifier = "==0.139.2" },
{ name = "uvicorn", marker = "extra == 'server'", specifier = "==0.51.0" },
]
provides-extras = ["server"]
[[package]]
name = "colorama"
version = "0.4.6"
@@ -313,7 +320,7 @@ dev = [
]
[package.metadata]
requires-dist = [{ name = "blendjob", path = "src/snapform/wheels/blendjob-0.1.5-py3-none-any.whl" }]
requires-dist = [{ name = "blendjob", path = "src/snapform/wheels/blendjob-0.1.6-py3-none-any.whl" }]
[package.metadata.requires-dev]
dev = [