Bump version to 0.11.2 and update uv version to 0.11.3

- Updated version in pyproject.toml and blender_manifest.toml to 0.11.2.
- Enhanced uv executable path documentation in client.py.
- Added inference_mode parameter to reconstruct_request function in client.py.
- Implemented uv download functionality in install_env.py with improved error handling and checksum verification.
- Modified install_uv function to download and extract uv binary instead of using bundled version.
- Updated job progress handling in operators.py to track progress stages.
- Improved download progress reporting in worker.py and adjusted related tests.
- Refactored tests to accommodate changes in status reporting and model downloading.
- Removed vendor.lock.toml as part of the cleanup process.
This commit is contained in:
2026-08-14 23:43:01 +08:00
parent 102e1bfa9b
commit 0c8d3a8988
22 changed files with 497 additions and 511 deletions

68
pack.py
View File

@@ -1,4 +1,3 @@
import hashlib
import tomllib
from pathlib import Path
from zipfile import ZIP_DEFLATED, ZipFile
@@ -6,49 +5,8 @@ from zipfile import ZIP_DEFLATED, ZipFile
PROJECT_ROOT = Path(__file__).resolve().parent
SOURCE_DIR = PROJECT_ROOT / "src" / "snapform"
VENDOR_DIR = PROJECT_ROOT / "vendor"
DIST_DIR = PROJECT_ROOT / "dist"
LOCK_PATH = PROJECT_ROOT / "vendor.lock.toml"
def load_vendor_lock():
"""Return the locked third-party artifact metadata."""
with LOCK_PATH.open("rb") as stream:
lock = tomllib.load(stream)
if lock.get("schema_version") != 1:
raise RuntimeError("Unsupported vendor.lock.toml schema")
return lock
VENDOR_LOCK = load_vendor_lock()
PLATFORMS = {
platform: artifact["filename"]
for platform, artifact in VENDOR_LOCK["platforms"].items()
}
def file_sha256(path):
"""Return the SHA-256 digest for a file."""
digest = hashlib.sha256()
with Path(path).open("rb") as stream:
while chunk := stream.read(1024 * 1024):
digest.update(chunk)
return digest.hexdigest()
def validate_artifact(path, expected_sha256):
"""Require an artifact to exist and match its locked digest."""
if not path.is_file():
raise RuntimeError(
f"Missing vendor artifact: {path}. "
"Run: uv run python prepare_vendor.py"
)
actual = file_sha256(path)
if actual != expected_sha256:
raise RuntimeError(
f"Vendor artifact hash mismatch: {path}. "
"Run: uv run python prepare_vendor.py"
)
PLATFORMS = ("windows-x64", "macos-arm64", "linux-x64")
def manifest_for_platform(platform):
@@ -73,21 +31,6 @@ def manifest_for_platform(platform):
return "\n".join(lines) + "\n"
def bundled_vendor_files(platform):
return {
f"vendor/{PLATFORMS[platform]}": VENDOR_DIR / PLATFORMS[platform]
}
def validate_vendor_files(platform):
"""Validate common archives and the selected uv archive."""
uv_artifact = VENDOR_LOCK["platforms"][platform]
validate_artifact(
VENDOR_DIR / uv_artifact["filename"],
uv_artifact["sha256"],
)
def build_extension(platform):
if platform not in PLATFORMS:
raise ValueError(f"Unsupported platform: {platform}")
@@ -96,8 +39,6 @@ def build_extension(platform):
f"{manifest['name']}.v{manifest['version']}.{platform}.zip"
)
DIST_DIR.mkdir(exist_ok=True)
vendor_files = bundled_vendor_files(platform)
validate_vendor_files(platform)
with ZipFile(output_path, "w", ZIP_DEFLATED) as archive:
for source_path in sorted(SOURCE_DIR.rglob("*")):
if not source_path.is_file():
@@ -105,8 +46,6 @@ def build_extension(platform):
if "__pycache__" in source_path.parts:
continue
relative_path = source_path.relative_to(SOURCE_DIR)
if relative_path.parts[0] == "vendor":
continue
if source_path.name == "blender_manifest.toml":
continue
archive.write(source_path, relative_path)
@@ -114,11 +53,6 @@ def build_extension(platform):
"blender_manifest.toml",
manifest_for_platform(platform),
)
for archive_name, source_path in vendor_files.items():
archive.writestr(
archive_name,
source_path.read_bytes(),
)
return output_path