feat: Add GitHub Actions workflow for building and testing the Depth Anything 3 extension

- Create a build workflow in `.github/workflows/build.yml` to automate the build process.
- Configure Python environment and install dependencies.
- Add steps for running tests and packaging the extension.

chore: Initialize project metadata and dependencies for Depth Anything 3

- Add `pyproject.toml` for project configuration and dependencies.
- Include optional dependencies for app and gs functionalities.
- Define project scripts and metadata.

chore: Add requirements file for Depth Anything 3 dependencies

- Create `requirements.txt` listing all necessary packages for the project.

feat: Implement export utility functions for Depth Anything 3

- Create `src/depth_anything_3/utils/export/__init__.py` to handle various export formats.
- Implement functions for exporting predictions in different formats.

feat: Add ray utility functions for homography estimation

- Create `src/depth_anything_3/utils/ray_utils.py` with functions for computing optimal rotation and homography using RANSAC.

feat: Implement vendor preparation script

- Add `prepare_vendor.py` to manage third-party dependencies and artifacts.
- Include functions for downloading and verifying artifacts based on a lock file.

test: Add unit tests for vendor preparation script

- Create `tests/test_prepare_vendor.py` to test artifact downloading and verification.
- Implement tests for handling hash mismatches and unsupported platforms.

chore: Add vendor lock file for dependency management

- Create `vendor.lock.toml` to define artifacts and platforms for the project.
This commit is contained in:
2026-08-09 11:44:24 +08:00
parent 97a720051f
commit 2e8af26cdf
17 changed files with 1341 additions and 108 deletions

View File

@@ -8,7 +8,7 @@ maintainer = "OmooLab"
type = "add-on"
blender_version_min = "4.5.0"
platforms = ["windows-x64", "macos-x64", "macos-arm64", "linux-x64"]
platforms = ["windows-x64", "macos-arm64", "linux-x64"]
license = ["SPDX:GPL-3.0-or-later"]
[permissions]

View File

@@ -1,4 +1,5 @@
import argparse
import filecmp
import json
import os
import platform
@@ -316,10 +317,10 @@ def install_stages(args, runtime_dir, python, uv):
else effective_torch_index(args.backend)
)
def archive_requirement(project_name, filename):
local = Path(args.runtime_dir).parent / "sources" / filename
local = Path(args.runtime_dir).parent / "vendor" / filename
if not local.is_file():
raise RuntimeError(
"Bundled source archive is missing; reinstall the extension: "
"Bundled vendor artifact is missing; reinstall the extension: "
f"{local}"
)
return f"{project_name} @ {local.as_uri()}"
@@ -539,29 +540,32 @@ def uv_download_target():
raise RuntimeError(f"Unsupported platform for uv download: {sys.platform}")
def bundled_sources_directory():
return Path(__file__).with_name("sources")
def bundled_vendor_directory():
packaged = Path(__file__).with_name("vendor")
if packaged.is_dir():
return packaged
project_root = Path(__file__).resolve().parents[2]
if (project_root / "pyproject.toml").is_file():
return project_root / "vendor"
return packaged
def bundled_uv_archive():
target, archive = uv_download_target()
path = bundled_sources_directory() / f"uv-{target}.{archive}"
path = bundled_vendor_directory() / f"uv-{target}.{archive}"
return path if path.is_file() else None
def sync_bundled_sources(bundled_dir, sources_dir):
"""Copy bundled source archives into the storage sources directory."""
def sync_bundled_vendor(bundled_dir, vendor_dir):
"""Copy bundled third-party archives into persistent storage."""
for name in ("depth-anything-3.tar.gz", "ben2.tar.gz"):
bundled = Path(bundled_dir) / name
if not bundled.is_file():
continue
target = Path(sources_dir) / name
if (
target.is_file()
and target.stat().st_size == bundled.stat().st_size
):
target = Path(vendor_dir) / name
if target.is_file() and filecmp.cmp(bundled, target, shallow=False):
continue
Path(sources_dir).mkdir(parents=True, exist_ok=True)
Path(vendor_dir).mkdir(parents=True, exist_ok=True)
shutil.copy2(bundled, target)
@@ -610,7 +614,7 @@ def install_uv(
if bundled_uv is None:
raise RuntimeError(
"Bundled uv is missing; reinstall the extension matching your "
f"platform (searched {bundled_sources_directory()})"
f"platform (searched {bundled_vendor_directory()})"
)
if not archive_is_valid(bundled_uv):
raise RuntimeError(f"Bundled uv archive is invalid: {bundled_uv}")
@@ -716,9 +720,9 @@ def install(args):
uv = Path(resolved) if resolved else uv
uv_missing = not uv.is_file()
python = environment_python(runtime_dir)
sync_bundled_sources(
bundled_sources_directory(),
Path(args.runtime_dir).parent / "sources",
sync_bundled_vendor(
bundled_vendor_directory(),
Path(args.runtime_dir).parent / "vendor",
)
stages = install_stages(args, runtime_dir, python, uv)
runtime_stages = [stage for stage in stages if stage[3] != "download"]