From 2ec69fe4d116bb51f717e0a4a3c8baed95a7101f Mon Sep 17 00:00:00 2001 From: Peter Corke Date: Thu, 13 Aug 2026 16:27:50 +1000 Subject: [PATCH] feat: relax opencv pin to support both 4.x and 5.x, add CI matrix axis pyproject.toml's opencv-python/opencv-contrib-python pin was capped at <5.0.0 since 2026-06-16, defensively, before the codebase actually supported OpenCV 5. PR #61 landed real OpenCV 5 compatibility fixes (aruco, HoughLinesP, BRISK/AKAZE, MSER) and release 2.2.0's changelog already headlined "works under both OpenCV 4 and 5" -- but the pin itself was never relaxed, so pip install could never actually resolve opencv5, and CI never exercised it either. Relax the pin to >=4.5,<6.0.0 per issue #44's plan, and add an opencv-version axis (4, 5) to ci.yml's test matrix so both are actually exercised on every push/PR, not just verified manually once. Verified locally in isolated venvs (not the ambient dev environment): full suite green against real opencv-contrib-python 4.14.0.94 (785 passed, 94 skipped) and 5.0.0.93 (784 passed, 95 skipped). Fixes #44 Co-Authored-By: Claude Sonnet 5 --- .github/workflows/ci.yml | 2 ++ pyproject.toml | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7a5226b7..cd5df204 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,6 +15,7 @@ jobs: matrix: os: [ubuntu-latest, macos-15, windows-latest] python-version: ["3.10", "3.11", "3.12", "3.13"] + opencv-version: ["4", "5"] steps: - uses: actions/checkout@v7 @@ -30,6 +31,7 @@ jobs: - name: Install package run: | pip install .[dev,tool] + pip install "opencv-python==${{ matrix.opencv-version }}.*" "opencv-contrib-python==${{ matrix.opencv-version }}.*" cd packages/mvtb-data && pip install . - name: Run tests diff --git a/pyproject.toml b/pyproject.toml index 710a2a2e..b270e657 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,8 +39,8 @@ dependencies = [ "scipy", "matplotlib", "pillow", - "opencv-python<5.0.0", - "opencv-contrib-python<5.0.0", + "opencv-python>=4.5,<6.0.0", + "opencv-contrib-python>=4.5,<6.0.0", "spatialmath-python", "pgraph-python", "ansitable",