Skip to main content

BlendJob

BlendJob 是面向 Blender Add-on 的本地 Job Server 运行时。它把 Blender Operator、独立 Python Environment、HTTP Job Server、FIFO Queue、进度、取消和 Resource 生命周期组合成一套可复用 API。

BlendJob 适合需要在 Blender 界面之外运行 AI 推理、模型下载、媒体处理或其它重型 Python 任务的 Add-on。Blender 主进程只保留轻量 Client 和 UI 逻辑,业务依赖安装在独立 Environment 中。

要求

  • Python 3.10 或更高版本
  • 支持 Python 3.10+ 的 Blender 版本
  • Windows x64、macOS arm64 或 Linux x64;内建 uv 安装器目前只提供这些平台

安装

普通 Python 项目可以使用 pip 或 uv:

python -m pip install blendjob
uv add blendjob

默认安装保持零依赖,适合 Blender 主进程。需要在普通 Python 环境中直接创建 FastAPI App 或运行 Runner 时,安装 server extra:

python -m pip install "blendjob[server]"

Blender Extension 需要把 BlendJob wheel 随扩展分发,并在 blender_manifest.toml 中声明:

wheels = ["./wheels/blendjob-0.1.5-py3-none-any.whl"]

同一个 wheel 还需要加入 Runtime 的独立 Environment,使 Server Python 可以执行 python -m blendjob.runner:

from pathlib import Path


blendjob_wheel = Path(__file__).parent / "wheels" / "blendjob-0.1.5-py3-none-any.whl"

environment = {
    "python": "3.10",
    "packages": [str(blendjob_wheel)],
    "platform_packages": {},
}

最小示例

Server package 导出一个 JobServer:

from blendjob import JobServer


server = JobServer("Example Job Server")


@server.job("double")
def double(context, parameters):
    context.progress(0.5, "Calculating")
    return {"value": parameters["value"] * 2}

Blender 侧创建一个 Runtime,并让业务 Operator 继承绑定后的基类:

from pathlib import Path

from blendjob import JobRuntime


runtime = JobRuntime(
    "server:server",
    entrypoint_root=Path(__file__).parent,
    storage_root=Path.home() / ".example-addon",
    environment=environment,
    namespace="example_addon",
)

JobOperatorBase = runtime.JobOperatorBase

完整的 Runtime、Operator、Server Handler、Resource 和存储结构说明见 开发者指南。

开发

uv sync
uv run pytest
uv build
uv run mkdocs build --strict

版本化文档使用 Mike:

uv run mike deploy --update-aliases 0.1 latest
uv run mike set-default latest

License

BlendJob 使用 MIT License。

Metadata

Release files for blendjob 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for blendjob 0.1.5
File Size Uploaded
blendjob-0.1.5.tar.gz 19.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for blendjob 0.1.5
File Interpreter ABI Platform
blendjob-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 44.1 kB

Release files / blendjob-0.1.5.tar.gz

Download URL blendjob-0.1.5.tar.gz
Size 19.7 kB
Tags Source
SHA-256 checksum
How to use checksums
2bbaf3c91b09b760d7d666072759b974e5d624139c95a850cf1a2fddb113884d
BLAKE2b-256 checksum
How to use checksums
78c9e23b117931dfaf5d090cdcbc975a3dfdda8fadd5f400a1ee8a81398a50ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / blendjob-0.1.5-py3-none-any.whl

Download URL blendjob-0.1.5-py3-none-any.whl
Size 24.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3b14665915c578c5b3743797189ee6ffec8ce14081a891dc8df18318a90c3691
BLAKE2b-256 checksum
How to use checksums
afec35bdc2708728e9c0f524464c26811af2cfc1b66a5815c4c17887af3f5b24
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

0.1.20

2 release files

0.1.19

2 release files

0.1.18

2 release files

0.1.17

2 release files

0.1.14

2 release files

0.1.13

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

This release

0.1.5 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page