Skip to content

boxmot.native._common

Build helpers for native trackers and the standalone native ReID encoder.

set_build_status_fn

set_build_status_fn(status_fn: Any) -> None

Register a callback used to report native build progress.

The callback is typically a WorkflowDetailCallback whose __call__ routes a status message into an active Rich workflow panel. When set, :func:run_build_step streams CMake output into the panel instead of printing it to stdout (which would corrupt the Rich Live region).

Pass None to clear the registration.

get_build_status_fn

get_build_status_fn() -> Any

Return the currently registered build status callback, if any.

run_build_step

run_build_step(
    *,
    cmd: list[str],
    label: str,
    status_fn: Any | None = None,
) -> int

Run a CMake build subcommand, routing output through status_fn.

When status_fn is callable (or registered via :func:set_build_status_fn), captures stdout/stderr line-by-line and forwards each line to the callback so it appears inside the active Rich workflow panel. When no callback is active, falls back to the legacy behaviour of streaming output to the terminal.

package_native_root

package_native_root() -> Path

Return the boxmot/native directory inside the installed package.

repo_root

repo_root() -> Path

Return the repository root.

Only valid for editable / source checkouts. Wheels installed via pip will typically not have a meaningful repo root above the package, so callers must treat the returned path as best-effort.

tracker_source_dir

tracker_source_dir(name: str) -> Path

Directory containing the C++ sources for a given native tracker.

Native C++ sources live at boxmot/native/cpp/trackers/<name>. The path is the same whether the package is imported from a source checkout or an installed wheel.

native_component_source_dir

native_component_source_dir(name: str) -> Path

Return the CMake source directory for a low-level native component.

tracker_build_dir

tracker_build_dir(name: str) -> Path

Out-of-tree CMake build directory used by editable / dev installs.

Located at <repo>/build/native/<name>. Wheels never write here.

installed_library_candidates

installed_library_candidates(
    name: str, lib_filename: str
) -> list[Path]

Where scikit-build-core places the shared library inside the wheel.

The build configuration installs the shared library beside the C++ source directory so it ships with the package and is loadable without re-running CMake at runtime.

build_library_candidates

build_library_candidates(
    name: str, lib_filename: str
) -> list[Path]

Editable-install fallback locations for the shared library.

library_filename

library_filename(tracker_name: str) -> str

Return the C-API shared library filename for a tracker on the current OS.

Convention: <tracker>_capi with the platform's shared-library suffix.

candidate_libraries

candidate_libraries(tracker_name: str) -> list[Path]

Installed-then-built search paths for the C-API shared library.

build_native_target

build_native_target(
    *,
    tracker_name: str,
    display_name: str,
    target: str,
    candidates: list[Path],
    force_rebuild: bool,
    not_found_message: str,
    build_lock: Lock,
) -> Path

Configure and build a single CMake target for a native tracker.

Packaged artifacts installed beside their sources are trusted as immutable. Editable-build artifacts are reused only when their recorded source/CMake fingerprint matches the current tree. Raises RuntimeError on configure/build failure or if the expected artifact is still missing.