- Vulnerability Checks: Before committing any changes that add or update dependencies or lockfiles (
Cargo.toml,Cargo.lock,pyproject.toml,requirements.txt), ALWAYS run:Ensure all dependencies have 0 known vulnerabilities across OSV, RustSec, GHSA, and PyPI databases.python .agents/skills/security-audit/scripts/audit_deps.py
- Security Advisories: If a vulnerability is flagged (e.g. via Trivy, Dependabot, or Sourcery PR checks), immediately upgrade the affected crate/package in
Cargo.toml/pyproject.toml, runcargo updateoruv lock, and adapt any breaking API changes.
- No UTF-8 BOM: All source files (
.py,.rs,.toml,.yml,.rst,.md) must be saved in standard UTF-8 without byte-order marks (\xef\xbb\xbf).
- Dual-Backend Parity: Any performance-critical function offloaded to
openpiv_rustMUST provide identical numerical results to its pure Python/SciPy counterpart. - Explicit Backend Control: Functions accelerated with Rust (
fft_correlate_images,find_subpixel_peak_position,correlation_to_displacement,sig2noise_ratio,local_norm_median_val,sliding_window_array) must accept abackend: str = "auto"parameter:"auto": Usesopenpiv_rustif installed, falls back cleanly to Python/SciPy."rust": Usesopenpiv_rust. Raises informativeImportErrorif not compiled/installed."scipy"/"python": Forces the pure Python/SciPy reference path.
- Test Suite Safety: Rust-specific tests must use
openpiv_rust = pytest.importorskip("openpiv_rust")at the module top level so test suites pass cleanly in environments without the Rust compiler.