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.6-py3-none-any.whl"]

Runtime 会在独立 Environment 中自动安装与 Blender 侧相同版本的 BlendJob,使 Server Python 可以执行 python -m blendjob.runner。packages 只声明 Job 自身的额外依赖;没有额外依赖时可以省略:

environment = {
    "python": "3.10",
}

最小示例

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.6

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.6
File Size Uploaded
blendjob-0.1.6.tar.gz 19.8 kB Details

Built distribution (wheel)

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

Total release size: 44.3 kB

Release files / blendjob-0.1.6.tar.gz

Download URL blendjob-0.1.6.tar.gz
Size 19.8 kB
Tags Source
SHA-256 checksum
How to use checksums
c876a2f26527b9e41513a38f6e3428f8846972a0f3498e2d8f1d6d7e50e96466
BLAKE2b-256 checksum
How to use checksums
8132dcc7001fc69bf92103da3ed7162b658fe2189d391e64deb867cdf5225388
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.6-py3-none-any.whl

Download URL blendjob-0.1.6-py3-none-any.whl
Size 24.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ed7c0ee4a0c952c25a7b6606bcd860b5c782ecb04ae6f9e7b1c475a03ab9c6b1
BLAKE2b-256 checksum
How to use checksums
f04605ae7d492ae417d5a276b87dd2894b04f8712421d518feb0cf016f729ec3
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

This release

0.1.6 This release

2 release files

0.1.5

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